This article mainly and everybody introduced the PHP simple computation Two time difference method, unifies the concrete instance form analysis PHP date and the conversion and the mathematics operation related operation skill, needs the friend may the reference, hoped can help to everybody.
<?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