Pelles C forum

C language => Beginner questions => Topic started by: tbayne on March 27, 2008, 09:02:13 PM

Title: Functions for Finding the Difference in Years Months Day Min Hr and Seconds
Post by: tbayne on March 27, 2008, 09:02:13 PM
Given two dates in the form of Day Month Year Minutes and Seconds is there a function in C to enter two dates and times and retrieve the difference in years months days hours minutes and seconds?
Title: Re: Functions for Finding the Difference in Years Months Day Min Hr and Seconds
Post by: JohnF on March 28, 2008, 11:39:28 AM
Given two dates in the form of Day Month Year Minutes and Seconds is there a function in C to enter two dates and times and retrieve the difference in years months days hours minutes and seconds?

Would the difftime function suit? It is declared in time.h

John
Title: Re: Functions for Finding the Difference in Years Months Day Min Hr and Seconds
Post by: severach on March 29, 2008, 05:36:23 AM
Looks like mktime() will get the dates converted for you. Wikipedia has more information.

Julian Day (http://en.wikipedia.org/wiki/Julian_day)