# 将24时变成下一天的00时
def t24_t00(strnum):
# 将时间字符串中24时转换为下一天的00时,例如2018123124时转换为2019010100时
import datetime
if strnum[8:10] == "24":
time1 = datetime.datetime.strptime(strnum[0:8],"%Y%m%d")
time2 = time1+datetime.timedelta(days=1)
time3=datetime.datetime.strftime(time2,format="%Y%m%d%H")+strnum[10:]
return time3
else:
return strnum
# print(t24_t00("201711302430"))
# print(t24_t00("20181231245959"))
网友评论