[New-bugs-announce] [issue26321] datetime.strptime fails to parse AM/PM correctly

Andrew Page report at bugs.python.org
Tue Feb 9 10:08:56 EST 2016


New submission from Andrew Page:

##
##  It appears that strptime is ignoring the AM/PM field
##
from datetime import datetime
d1 = datetime.strptime("1:00 PM", "%H:%M %p")
d2 = datetime.strptime("1:00 AM", "%H:%M %p")
d1.hour, d2.hour
(1, 1) # d1 should be 13
d1 == d2
True # and these should not be equal

----------
components: Library (Lib)
messages: 259936
nosy: aepage
priority: normal
severity: normal
status: open
title: datetime.strptime fails to parse AM/PM correctly
versions: Python 3.5

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


More information about the New-bugs-announce mailing list