Skip to content

Instantly share code, notes, and snippets.

@libert-xyz
Created September 22, 2016 00:49
Show Gist options
  • Save libert-xyz/13f69eff9c4c16b2abaf41d6a3b3cfff to your computer and use it in GitHub Desktop.
Save libert-xyz/13f69eff9c4c16b2abaf41d6a3b3cfff to your computer and use it in GitHub Desktop.
import time
#Example of counting days to an event:
from datetime import date
today = date.today()
today
today == date.fromtimestamp(time.time())
my_birthday = date(today.year, 6, 24)
if my_birthday < today:
my_birthday = my_birthday.replace(year=today.year + 1)
my_birthday
time_to_birthday = abs(my_birthday - today)
time_to_birthday.days
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment