import time

djsj_str="2020-05-22 15:30:29" #a 冻结时间字符串
djsc =7*24*60*60 #b 冻结时长 7天
t1 =time.strptime(djsj_str,"%Y-%m-%d %H:%M:%S")
t2 =time.mktime(t1) #冻结时间点的时间戳
while True:
dqsj =time.time() #当前时间
ygsj =dqsj-t2 #已过时间=当前时间 - 冻结时间
sysj =djsc -ygsj #剩余时间
hour =60*60
day =24*60*60
tian =sysj//day
xiaoshi =sysj%day//hour
fenzhong=sysj%hour//60
miao =sysj%60

print("还有{}天{}小时{}分钟{}秒解冻".format(
int(tian),
int(xiaoshi),
int(fenzhong),
int(miao)
) )
time.sleep(1)
# x=time.localtime(522293)
# print(x)



版权声明:本文为acmcoder原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/acmcoder/p/12952926.html