There are two dates with the time in the format DATETIME (eg. 2017-12-28 15:00 and 2017-12-29 12:00)

How to get the date and time from the first to the second date?

1 answer 1

As an option

$datetime1 = date_create('2017-12-28 15:00:00'); $datetime2 = date_create('2017-12-29 12:00'); $interval = date_diff($datetime1, $datetime2); echo $interval->format('%R %a дней %h часов %i минут'); 

Check http://sandbox.onlinephpfunctions.com/code/f673f829304db7748d6fcc9a163eef8ad9b69509

Read more http://php.net/manual/ru/dateinterval.format.php