# -*- coding : UTF-8 _*_
# 开发职员: jianxionglyu
# 开发时间: 2023/2/14 16:57
# 文件名称: TimeShow.py
# 开发工具: PyCharm
import datetime
import time
AScheduledTime = datetime.datetime(2023, 6, 18, 0, 0, 0) #设置预定时间
Anow = datetime.datetime.today() #获取现在的时间
ADifference = AScheduledTime - Anow #存储两个时间的时差,差精确到毫秒
Asec = ADifference.seconds #间隔预定时间尚有多少秒
while (Asec):
while (1):
ScheduleTime = datetime.datetime(2023, 6, 18, 0, 0, 0)
now = datetime.datetime.today()
Difference = ScheduleTime - now
day = Difference.days
sec = Difference.seconds
hour =int(sec /60 /60)
minute =int(sec /60 %60)
second = sec %60
print('间隔618尚有:' +str(day) +'每天' +str(hour) +'时' +str(minute) +'分' +str(second) +'秒')
time.sleep(1)
Asec -=1 |