php - DateTime::diff returnig not correct result
one text
I have this code
$origin = new DateTime(date("Y-m-d H:i",filectime("bowl.json")));
$target = new DateTime("now");
echo $origin->format('Y-m-d H:i').'<br/>';
echo $target->format('Y-m-d H:i').'<br/>';
$interval = $origin->diff($target);
echo $gg=$interval->format('%i minutes ');
if($gg<720 AND file_exists("file.json")){
echo 'too soon';
die();
}
And the output is like this:
2022-11-16 17:12
2022-11-17 16:23
11 minutes too soon
2022-11-16 17:12
2022-11-17 16:53
41 minutes too soon
Why is the function only returning the difference between minutes not counting hours and days?
Source