def event_remaining(dt_start, dt_end):
now = datetime.datetime.now(timezone.utc)
diff_end = dt_end - now
diff_start = now - dt_start
if diff_start.total_seconds() < 0:
return "Event has not started yet!"
elif diff_end.total_seconds() < 0:
return "Event has ended!"
else:
seconds = diff_end.seconds
hours = seconds // 3600
seconds -= hours * 3600
minutes = seconds // 60
seconds -= minutes * 60
return "Event ends in {} days, {} hours, {} minutes and {} seconds.".format(diff_end.days, hours, minutes, seconds)
###### Sunshine ######
评论列表
文章目录