This article mainly introduced the PHP simple calculation two time difference method, unifies the concrete instance form to analyze the PHP date and the Times transformation and the mathematics operation related operation skill, needs the friend to consult under
In this paper, a simple calculation of PHP two time difference method is described. Share to everyone for your reference, as follows:
<?php//php calculates the method of two time difference $startdate = "2010-12-11 11:40:00"; $enddate = "2012-12-12 11:45:09"; $date =floor ((Strtotime ($ EndDate)-strtotime ($startdate))/86400), $hour =floor ((Strtotime ($enddate)-strtotime ($startdate))/86400/3600); Minute=floor ((Strtotime ($enddate)-strtotime ($startdate))/86400/60), $second =floor ((Strtotime ($enddate)- Strtotime ($startdate))/86400/60); Echo $date. " Day <br> "Echo $hour." H <br> "; Echo $minute." Minutes <br> "Echo $second." Seconds <br> ";
Operation Result:
732 days, 0 hours, 12 minutes, 12 seconds