Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get the date difference

Status
Not open for further replies.

zyrag

IS-IT--Management
Joined
Dec 4, 2002
Messages
252
Location
PH
i tried to find a function from the manual but it seems that there's none. Or, is there?

how do you get the date difference between two dates?

thanks,
 

This snippet is offered on the above page:

function date_diff($date1, $date2) {
 $s = strtotime($date2)-strtotime($date1);
 $d = intval($s/86400);
 $s -= $d*86400;
 $h = intval($s/3600);
 $s -= $h*3600;
 $m = intval($s/60);
 $s -= $m*60;
 return array("d"=>$d,"h"=>$h,"m"=>$m,"s"=>$s);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top