import datetime
now = datetime.datetime.now()
formatted_date = now.strftime(“%Y-%m-%d”) # 格式化日期为YYYY-MM-DD formatted_time = now.strftime(“%H:%M:%S”) # 格式化时间为HH:MM:SS
print(“Formatted Date:”, formatted_date) print(“Formatted Time:”, formatted_time)