1

Basically whenever a user gives a number of days for example 10 and the starting year is 2008 it will convert the days and add it to years so it will still be 2008, but how do i account for leap year? For example if i enter 848 from 2008 it should be 2010 but its 2011. So far what i have:

def year_checker(days, year):
     convert = days // 365
     year = year + convert
     return year

This question is a different from some because it messes up when trying to find the days between two leap years.

user3373402
  • 53
  • 1
  • 1
  • 7

1 Answers1

0

https://support.microsoft.com/en-us/kb/214019

This article tells you about how to calculate leap years. You could implement that formula and check for leap years, then subtract 366 for every leap year encountered. I hope this helps for now. I will improve this answer with sample code later.

jkschin
  • 5,776
  • 6
  • 35
  • 62