Finding days between 2 unix timestamps in php

前端 未结 8 1178
一整个雨季
一整个雨季 2020-12-13 18:57

Hay, i have a database holding events. There are 2 fields \'start\' and \'end\', these contain timestamps. When an admin enters these dates, they only have the ability to se

8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-13 19:13

    $d1=mktime(22,0,0,1,1,2007);
    $d2=mktime(0,0,0,1,2,2007);
    echo "Hours difference = ".floor(($d2-$d1)/3600) . "
    "; echo "Minutes difference = ".floor(($d2-$d1)/60) . "
    "; echo "Seconds difference = " .($d2-$d1). "
    "; echo "Month difference = ".floor(($d2-$d1)/2628000) . "
    "; echo "Days difference = ".floor(($d2-$d1)/86400) . "
    "; echo "Year difference = ".floor(($d2-$d1)/31536000) . "
    ";

    http://www.plus2net.com/php_tutorial/date-diff.php

    http://www.phpf1.com/tutorial/php-date-difference.html

提交回复
热议问题