开发者

subtract time. Day is same [duplicate]

This question alre开发者_运维百科ady has answers here: Closed 11 years ago.

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;
 ?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜