PHP Date difference -
i've following code:
$dstart = new datetime('2013-03-15'); $dend = new datetime('2013-04-01'); $ddiff = $dstart->diff($dend); echo $ddiff->days;
i don't know why i'm getting 6015 result.
try like
$dstart = strtotime('2013-03-15'); $dend = strtotime('2013-04-01'); $ddiff = $dend - $dstart; echo date('h:i:s',$ddiff);
or per code try with
$ddiff = $dstart->diff($dend); $date->format('d',$ddiff); echo $ddiff->days;
if want diff in days try also
echo floor($ddiff/(60*60*24));
Comments
Post a Comment