Below are 2 datetime strings with AM/PM. The AM containing string returns the exact same datetime object value as the PM containing string. What am I doing wrong?
from datetime import datetime
format ='%d %b %y %H:%M %p'
date_str ='23 Feb 22 12:57 PM'
print(datetime.strptime(date_str, format))
# 2022-02-23 12:57:00
date_str ='23 Feb 22 12:57 AM'
print(datetime.strptime(date_str, format))
# 2022-02-23 12:57:00