difference in dates

How do I calculate the difference in date?

e.g
8/31/2110 - 2/27/1977 = 48762



1) number_of_days(int month, int day) // return the nth number of days of the year.
E.G dec 31 = 365 for non leap year.
feb 02 = 33

2)daysInmonth( int month, int year) // returns the number of days in a given month
e.g if month is 4(april) daysInmonth will return 30.
if month = 2(feb) it will automatically check whether it is a leap year, if it is it will return 29 if not it will return 28.

3) isleapyear(int year) // return true if leap year, false if not.

Last edited on
Topic archived. No new replies allowed.