D
davelist
I'm guessing there is an easy way to do this but I keep going around
in circles in the documentation.
I have a time stamp that looks like this (corresponding to UTC time):
start_time = '2007-03-13T15:00:00Z'
I want to convert it to my local time.
start_time = time.mktime(time.strptime(start_time, '%Y-%m-%dT%H:%M:
00Z'))
start_time -= time.timezone
This was working fine now, but if I do it for a date next week (such
as March 13th in the above example), it breaks because my local time
moves to daylight savings time this weekend. So my time is now off by
an hour. I'm guessing if I try this next week it will work okay
because time.timezone will be give a different value next week - is
that correct?
Is there a direct way to convert that timestamp in UTC to a local
time stamp that will always work?
TIA,
Dave
in circles in the documentation.
I have a time stamp that looks like this (corresponding to UTC time):
start_time = '2007-03-13T15:00:00Z'
I want to convert it to my local time.
start_time = time.mktime(time.strptime(start_time, '%Y-%m-%dT%H:%M:
00Z'))
start_time -= time.timezone
This was working fine now, but if I do it for a date next week (such
as March 13th in the above example), it breaks because my local time
moves to daylight savings time this weekend. So my time is now off by
an hour. I'm guessing if I try this next week it will work okay
because time.timezone will be give a different value next week - is
that correct?
Is there a direct way to convert that timestamp in UTC to a local
time stamp that will always work?
TIA,
Dave