from datetime import datetime
# 固定的时刻:输出始终相同
moment = datetime(2027, 1, 1, 22, 13, 20)
# %I 是 12 小时制,%p 是 AM/PM
short_style = moment.strftime("%m/%d/%y %I:%M %p")
# short_style is '01/01/27 10:13 PM'
custom_style = moment.strftime("%Y-%m-%d")
# custom_style is '2027-01-01'
# 不指定格式:日期、空格、时间
standard_style = str(moment)
# standard_style is '2027-01-01 22:13:20'
# ISO 8601 格式,日期与时间之间用 "T"
iso_style = moment.isoformat()
# iso_style is '2027-01-01T22:13:20'
# f-string 使用同样的格式代码
str_format = f"Today {moment:%d %B}"
# str_format is 'Today 01 January'
print(f"{short_style = }")
print(f"{custom_style = }")
print(f"{standard_style = }")
print(f"{iso_style = }")
print(f"{str_format = }")