Maybe I misunderstand the purpose of tzinfo, but I have a datetime object. dtI managed to get into this form:
datetime.datetime(2017, 7, 2, 20, 0, tzinfo=tzoffset('PDT', -7))
I am trying to submit the indicated date from July 2, 2017, 20:00 PDT.
Now I would like to convert this time to UTC, but when I do this, it displays the UTC timestamp for July 2nd 2017 20:00 UTC, it does not apply the difference of 7 hours.
For instance:
>>> dt.timestamp()
1499025607.0
What is it: Sunday, July 2, 2017 8:00:07 PM
Besides
>>> dt.isoformat()
'2017-07-02T20:00:00-00:00:07'
I tried
>>> dt.astimezone(pytz.UTC).timestamp()
1499025607.0
Please note that the same timestamps as dt.timestamp()
source
share