Skip to content

Instantly share code, notes, and snippets.

@dansku
Created March 8, 2017 22:50
Show Gist options
  • Select an option

  • Save dansku/f1b2770f62eb7b934eac596c7b79da99 to your computer and use it in GitHub Desktop.

Select an option

Save dansku/f1b2770f62eb7b934eac596c7b79da99 to your computer and use it in GitHub Desktop.
Display a countdown for the numbers of the day until a certain date
#calculate time differnece
import time
import os
while True:
now = time.time() #1488997525
end = 1517504400
difference = end - now
if difference > 0:
days = int(difference / 86400)
hours = int((difference - (days * 60 * 60 * 24))/(60*60))
minutes = int((difference - (days * 60 * 60 * 24) - (hours * 60 * 60 ))/60)
seconds = int(difference - (days * 60 * 60 * 24) - (hours * 60 * 60 ) - (minutes * 60))
print str(days) + " " + str(hours)+":"+str(minutes)+":"+str(seconds)
else:
print "666 66:66:66"
time.sleep(0.1)
os.system('cls')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment