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