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

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -