[issue12886] datetime.strptime parses input wrong

Heiðar Rafn Harðarson report at bugs.python.org
Mon Sep 5 16:33:08 CEST 2011


Heiðar Rafn Harðarson <heidar.rafn at hrolfsskali.net> added the comment:

My understanding of the python documentation and the ISO 8601 standard is that the digits in a timestamp representing hours, minutes and seconds shall always be in pairs of 2 digits (hh, mm, ss), i.e. when a number is less than 10 it should be preceded by 0. 
In the example I give, the minute figure is split between minutes and seconds by the  python library function which I consider a bug: 
datetime.datetime.strptime('20110817T1234','%Y%m%dT%H%M%S') 
gives
datetime.datetime(2011, 8, 17, 12, 3, 4)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12886>
_______________________________________


More information about the Python-bugs-list mailing list