[wd_asp elements=’search’ ratio=’100%’ id=1]

Calculating Date Difference

17th February 2017

Php - Dates & Time

php codehaven

$start_date = new DateTime('2007-09-01 04:10:58');
$since_start = $start_date->diff(new DateTime('2012-09-11 10:25:00'));
echo $since_start->days.' days total
';
echo $since_start->y.' years
';
echo $since_start->m.' months
';
echo $since_start->d.' days
';
echo $since_start->h.' hours
';
echo $since_start->i.' minutes
';
echo $since_start->s.' seconds
';