By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,931 Members | 1,567 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,931 IT Pros & Developers. It's quick & easy.

time.strptime

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.