Datetime은 일/월/년의 시간 데이터 형식을 연/월/일로 변환합니다.

Python에서 시간 데이터 형식을 변환하려면 Python의 내장 함수 datetime.strptimedatetime.strftime.

아래는 예입니다:

from datetime import datetime# 将日/月/年格式的字符串转化为日期对象
date_string = "10/01/2023"
date_object = datetime.strptime(date_string, "%d/%m/%Y")
 
# 将日期对象转化为年/月/日格式的字符串
formatted_date_string = date_object.strftime(

おすすめ

転載: blog.csdn.net/weixin_35770067/article/details/132549734