I am trying to find the time difference between 2 timestamps.
Timestamp "startTime" have 1601096400
Timestamp "expireTime" have 1601094600
I want to output the difference between both time like Expire in : 4hr 30min
How do I do it in php ?
I am trying to find the time difference between 2 timestamps.
Timestamp "startTime" have 1601096400
Timestamp "expireTime" have 1601094600
I want to output the difference between both time like Expire in : 4hr 30min
How do I do it in php ?
Try This is work proper.
<?php
$diff = 1601096400 - 1601094600;
//if use date so try this
$diff = strtotime("2020-09-26 08:10:00") - strtotime("2020-10-26 04:42:00");
$days = floor($diff / 86400);
$hours = floor(($diff - ($days * 86400)) / 3600);
$minutes = floor(($diff - ($days * 86400) - ($hours * 3600))/60);
$seconds = floor(($diff - ($days * 86400) - ($hours * 3600) - ($minutes*60)));
echo 'Expire in : '$hours.'hr'.$minutes.'min';
?>