timezones

Jaap van Wingerde lezen at vanwingerde.nl
Wed Feb 6 09:27:06 EST 2019


I made a small script to practise with timezones:

#!/usr/bin/env python3
# -*- coding: utf_8 -*-
from datetime import datetime, timedelta
from pytz import timezone
import pytz
amsterdam_datetime = datetime(2018, 12, 17, 11, 31, 26,
tzinfo=timezone('Europe/Amsterdam'))
print(amsterdam_datetime)
utc_datetime = amsterdam_datetime.astimezone(pytz.utc)
print(utc_datetime)
amsterdam_datetime = datetime(2018, 6, 17, 11, 31, 26,
tzinfo=timezone('Europe/Amsterdam'))
print(amsterdam_datetime)
utc_datetime = amsterdam_datetime.astimezone(pytz.utc)
print(utc_datetime)

The output of the script is:
2018-12-17 11:31:26+00:20
2018-12-17 11:11:26+00:00
2018-06-17 11:31:26+00:20
2018-06-17 11:11:26+00:00

I respected:
2018-12-17 11:31:26+01:00
2018-12-17 10:31:26+00:00
2018-06-17 11:31:26+02:00
2018-06-17 09:31:26+00:00

I need this functionality for adjusting wrong timestamps in Android
JPG-images as the 'Exif.GPSInfo.GPSTimeStamp' and
'Exif.GPSInfo.GPSDateStamp' are missing.

Why I get this unrespected results?

Kind regards,
Jaap.


-- 

Jaap van Wingerde
e-mail: 1234567890 at vanwingerde.nl



More information about the Python-list mailing list