subtract time. Day is same [duplicate]
Possible Duplicate:
Subtract time in PHP
How can i subtract time? the day remains the same. i just need to subtract two time.
Date = 2011-04-26 Starttime = 12:39:53 Endtime = 14:34:28
now i need to calculate the time difference between Endtime and Starttime.
Thanks
Try this one:
<?php
$lasttime = strtotime("-67 minutes"); // for instance
$currentdate = strtotime("now");
$lastact = date("Y-m-d g:i:s a", $lasttime);
$now = date("Y-m-d g:i:s a", $currentdate);
$daycheck = date("d", $now) - date("d", $lastact);
$minutecheck = date("i", $now) - date("i", $lastact);
$difference = $currentdate - $lasttime;
?>
精彩评论