[issue26321] datetime.strptime fails to parse AM/PM correctly

2016-02-09 Thread Zachary Ware
Zachary Ware added the comment: This is a documented peculiarity of the %p format code, see the '%p' entry in the table at [1], note 3 in particular. >>> from datetime import datetime >>> datetime.strptime('1:00 PM', '%H:%M %p').hour 1 >>> datetime.strptime('1:00 PM', '%I:%M %p').hour 13 [1]

[issue26321] datetime.strptime fails to parse AM/PM correctly

2016-02-09 Thread Andrew Page
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