Answers for "calculate difference between two different date.now()"

PHP
6

How to calculate the difference between two dates

$datetime1 	= new DateTime('2020-10-11 16:52:52');
$datetime2 	= new DateTime('2020-10-13 16:52:52');
$interval 	= $datetime1->diff($datetime2);

echo $interval->format('%a days');
Posted by: Guest on June-26-2020
0

Find difference between two dates in minutes

$time = new DateTime("2012-09-21 12:12:22");
$diff = $time->diff(new DateTime());
$minutes = ($diff->days * 24 * 60) +
           ($diff->h * 60) + $diff->i;
Posted by: Guest on May-26-2021

Code answers related to "calculate difference between two different date.now()"

Browse Popular Code Answers by Language