Page 1 of 1

Calculating time differences

Posted: Sun Dec 05, 2004 10:31 am
by rp
Hi folks

This is one I always get "lost" on, calculating time differences.

need to calculate the time difference between $row['startdate'] (a 0000-00-00 date field in the db) and $datToday = date('Y,m,d');


Any help much appreciated.

Thanks

Posted: Sun Dec 05, 2004 11:10 am
by kettle_drum
Do mktime() on the start date, and then use time() to get the current time, and then subtract them, and then your left with the number of seconds from the start date and do what you like with that.

Posted: Sun Dec 05, 2004 11:27 am
by timvw
or consider one of the many available date and time functions for your sql product and do the calculations there.....