determine time between two dates

• 04-27-2002
cbassett01
determine time between two dates
If I have six variables, startMonth, startDay, startYear, endMonth, endDay and endYear, all defined as ints, does anyone know about any algorythm/function that can subtract the end date (endMonth endDay and endYear) from start date (startMonth, startDay, startYear) and find the number of days, months and/or years in between the two dates.

Thanks
Chris
cbassett01@yahoo.com
http://www.tbcnet.com/~cbassett
• 04-27-2002
Prelude
Use the day and month variables to determine the number of days that have passed in each year and find the difference in those two values. Then take that difference and add the number of full years between the two dates multiplied by 365, that's the number of days between the two dates. From there you can easily calculate how many months and years have passed.

-Prelude
• 04-27-2002
Salem
mktime() and difftime()
Both in time.h
Will tell you the difference in seconds
Should be able to take it from there