Thursday, July 30, 2009

How to find difference in minutes between two dates in c/c++?

The string is in the following format:


Expires: Mon, 07 Jan 2008 17:24:10 GMT


Last-Modified: Mon, 07 Jan 2008 17:22:55 GMT


I want to find the difference in minutes as simple as possible

How to find difference in minutes between two dates in c/c++?
Here's one way, although it may not be very simple: You would have to parse out the strings and get the day, month, year, hour minute and second parts from the string (perhaps using sscanf) and construct a tm struct from it. You would then use mktime() to create the time_t structure for enabling mathematical operations.





You would then use a difftime() function in ctime library to determine the difference in seconds and then convert it into minutes.

potential break up song

No comments:

Post a Comment