469,352 Members | 1,671 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

time.strptime

I have strings representing UTC dates and I want to convert them in time tuples
using time.strptime. I have an issue with daylight savings.
For instance

Tue Sep 14 06:06:15 2004

is converted to

(2004, 9, 14, 6, 6, 15, 1, 258, -1)

The last "-1" means daylight savings. I want it to be 0.
I tried to play with time.daylight and time.timezone but with no luck.
Any hints?
TIA,

Michele Simionato
Jul 18 '05 #1
1 4405
Michele Simionato <mi***************@gmail.com> wrote:
I have strings representing UTC dates and I want to convert them in time
tuples using time.strptime. I have an issue with daylight savings. For
instance

Tue Sep 14 06:06:15 2004

is converted to

(2004, 9, 14, 6, 6, 15, 1, 258, -1)

The last "-1" means daylight savings. I want it to be 0.
I tried to play with time.daylight and time.timezone but with no luck.

s='Tue Sep 14 06:06:15 2004'
time.strptime(s) (2004, 9, 14, 6, 6, 15, 1, 258, -1) time.strptime(s, '%a %b %d %H:%M:%S %Y') (2004, 9, 14, 6, 6, 15, 1, 258, -1) time.strptime(s+' UTC', '%a %b %d %H:%M:%S %Y %Z')

(2004, 9, 14, 6, 6, 15, 1, 258, 0)
Alex
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Gerrit Holl | last post: by
10 posts views Thread by Maksim Kasimov | last post: by
3 posts views Thread by Ilja Booij | last post: by
4 posts views Thread by Maximilian Michel | last post: by
1 post views Thread by davelist | last post: by
2 posts views Thread by Joshua J. Kugler | last post: by
2 posts views Thread by barronmo | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.