python 对于当前时间加减30分钟或者1个小时
参考博客:https://www.cnblogs.com/monogem/p/11170011.html
给特定时间加1个小时
import datetime
startTime = '2021-06-04 15:40:00'
# endTime = '2019-07-11 15:35'
for i in range(1):
endTime = (datetime.datetime.strptime(startTime, "%Y-%m-%d %H:%M:%S") + datetime.timedelta(
hours=1)).strftime("%Y-%m-%d %H:%M:%S")
# print (startTime,endTime)
print(endTime)
# startTime = endTime# 参数days=1(天+1) 可以换成 minutes=1(分钟+1)、
# seconds=1(秒+1)、hours=1(小时)
还没有评论,来说两句吧...