Skip to content

Instantly share code, notes, and snippets.

@stonemirror
Last active March 11, 2018 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stonemirror/547785bcda19ccf1bc4eeb69a4ae94e7 to your computer and use it in GitHub Desktop.
Save stonemirror/547785bcda19ccf1bc4eeb69a4ae94e7 to your computer and use it in GitHub Desktop.
Eternal September Date Calculation
import datetime
days = ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"]
theNow = datetime.datetime.now()
theWeekday = days[theNow.weekday()]
theSeptDay = (datetime.date(theNow.year, theNow.month, theNow.day) - datetime.date(1993, 8, 31)).days
theLastDigit = theSeptDay % 10
if theLastDigit == 1:
theOrdinal = "st"
elif theLastDigit == 2:
theOrdinal = "nd"
elif theLastDigit == 3:
theOrdinal = "rd"
else:
theOrdinal = "th"
print("Today is {}, the {}{} of SEPTEMBER, 1993".format(theWeekday, theSeptDay, theOrdinal))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment