php - Days between two dates and time -
php - Days between two dates and time -
$dday = mktime(13, 00,00, 02, 07, 2013); $today = mktime(12,30,00, 02, 08, 2018); $difference = $today - $dday; $datecalculation = floor($difference / 84600); echo $datecalculation;
the day 1. not 1. day 1 when time 13.00.can reply me please?
the datetime class makes working dates , times much easier them mktime()
$datetime1 = new datetime('2013-02-07 13:00:00'); $datetime2 = new datetime('2013-02-08 12:30:00'); $interval = $datetime1->diff($datetime2); $elapsed = $interval->format('%a days %h hours'); echo $elapsed . php_eol; echo "days: " . $interval->format('%a') . php_eol; // output 0 days 23 hours days: 0
see in action
php date days date-math
Comments
Post a Comment