September 19th, 2002, 09:59 PM
different between two time and date
Hi... i need an idea on how to do this...
let say i have to time....
9/20/2002 10:55:35 AM and 9/25/2002 8:30:35 AM
what is the algorithm to calculate between this to time. I need to know the number of day and time...
September 20th, 2002, 04:06 PM
Most programming languages have native date types which are computed as number of seconds since 1970 (or 1980 or 1900 or whatever, depending on your language. Search the web for "epoch date" for more information). They also have a way to convert a date string to the native date type and vice versa. So, all you have to do is convert the date string to an epoch date and then, all you have to do is subtract one date from another, which will give you the difference between the two dates in seconds. After that, it' just a matter of converting the seconds back into days, hours, minutes and seconds.
Hope this helps.