自定义日期时间格式 Python

Custom datetime formating Python

我想创建自定义格式的日期,我正在为此苦苦挣扎,需要帮助。
是否可以在 Python 中创建类似“02FEB2021 00:00:00”的日期时间格式?

custom formatter

from datetime import datetime

fmt = "%d%b%Y %H:%M:%S"

date_str = datetime.now().strftime(fmt).upper()
print(date_str)  # 04NOV2021 19:07:50

date = datetime.strptime(date_str, fmt)
print(date)  # 2021-11-04 19:07:50