📅  最后修改于: 2022-03-11 14:45:51.430000             🧑  作者: Mango
from datetime import datetime
d = datetime.strptime("10:30", "%H:%M")
print(d.strftime("%I:%M %p")) # outputs '10:30 AM'
d = datetime.strptime("22:30", "%H:%M")
print(d.strftime("%I:%M %p")) # outputs'10:30 PM'