One way is to convert both dates into a Julian date, which is an integer number of days from a certain date in the past.
Here is one method in C for doing so. Yo can then subtract one value from the other to find the number of days between the two dates.