For Example:
echo $interval->format('%h.%i Hours');
I want to store it in integer. How do i do it ?
Thanks.
For Example:
echo $interval->format('%h.%i Hours');
I want to store it in integer. How do i do it ?
Thanks.
You could do this
$interval = new DateInterval('P2Y4DT6H8M');
$str = $interval->format('%d:%h:%i:%s');
list($days, $hours, $minutes, $seconds) = explode(':', $str);
$elapsedSeconds = ($days*86400) + ($hours*3600) + ($minutes*60) + $seconds;
echo $elapsedSeconds;