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] https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior ---------- nosy: +zach.ware resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26321> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com