开发者

subtract time. Day is same [duplicate]

开发者 https://www.devze.com 2023-02-28 21:39 出处:网络
This question alre开发者_运维百科ady has answers here: Closed 11 years ago. Possible Duplicate: Subtract time in PHP
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

精彩评论

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

关注公众号