datetime模块
import datetime
--时间加减的模块
#返回当前时间
print(datetime.datetime.now())
--2019-09-28 17:22:14.544130
print(datetime.date.fromtimestamp(time.time()))
--2019-09-028
# 当前时间+3天
print(datetime.datetime.now() + datetime.timedelta(3))
# 当前时间-3小时
print(datetime.datetime.now() + datetime.timedelta(hours=-3))
# 时间替换
c_time = datetime.datetime.now()
print(c_time.replace(minute=20, hour=5, second=13))
原文地址:https://www.cnblogs.com/shaozheng/p/11604386.html
时间: 2024-11-06 09:44:12