Title: strptime 1/4/2011 02:00:00 problem
Type: behaviour Severity: normal
Components: Library Versions: Jython 2.7
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: alexeyts, amak, fwierzbicki
Priority: Keywords:

Created on 2011-09-25.12:00:30 by alexeyts, last changed 2013-02-25.19:26:37 by fwierzbicki.

msg6652 (view) Author: Alexey (alexeyts) Date: 2011-09-25.12:00:29
There's a problem with strptime for a concrete date & time.
Specifically, for april 1st 2011, 2am, the hour gets shifted one hour ahead.
This happens only for this specific date and hour.

>>> print datetime.strptime('1/4/2011 02:00:00', '%d/%m/%Y %H:%M:%S')
2011-04-01 03:00:00
msg6678 (view) Author: Alan Kennedy (amak) Date: 2011-10-15.11:34:35
Works for me.

Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.5.0_21
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> print datetime.strptime('1/4/2011 02:00:00', '%d/%m/%Y %H:%M:%S')
2011-04-01 02:00:00

This is almost certainly a timezone issue, relating to daylight saving time. I'd be surprised if it happens only for this specific time.

What is the timezone setting for the machine on which you're running the code? What happens if you include a timezone in the time string?
msg7741 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2013-02-25.19:26:23
Closing as there was no response. Probably this is fixed in 2.7 since we have done a lot of work for i18n.
Date User Action Args
2013-02-25 19:26:37fwierzbickisetversions: + Jython 2.7, - 2.5.2
2013-02-25 19:26:23fwierzbickisetstatus: open -> closed
resolution: out of date
messages: + msg7741
nosy: + fwierzbicki
2011-10-15 11:34:35amaksetnosy: + amak
messages: + msg6678
2011-09-25 12:00:30alexeytscreate