Skip to content

Instantly share code, notes, and snippets.

@gabrielbissey
Last active February 7, 2018 21:52
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 gabrielbissey/2a946869c3957417e85d086265fb771c to your computer and use it in GitHub Desktop.
Save gabrielbissey/2a946869c3957417e85d086265fb771c to your computer and use it in GitHub Desktop.
Calculates number of days between input dates *DOES NOT ACCOUNT FOR LEAP DAYS YET*
def number_of_days(year, month, day):
count = 0
count += (year * 360)
count += (month * 30)
count += day
return count
def days_between_dates(year1, month1, day1, year2, month2, day2):
date1 = number_of_days(year1, month1, day1)
date2 = number_of_days(year2, month2, day2)
return date2 - date1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment