import time
time_start = time.time() # 获取当前时间戳
date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) # 获取当前:年、月、日、时、分、秒
print(date)
date = time.strftime("%Y-%m-%d", time.localtime()) # 获取当前:年、月、日
print(date)
date = time.strftime("%H:%M:%S", time.localtime()) # 获取当前:时、分、秒
print(date)
python获取当前日期、时间
最新推荐文章于 2024-04-25 10:00:00 发布