How to get Diference Between 2 time stamps in minutes

To calculate the difference between two timestamps in minutes , Here’s an example:

 

$startdate_time='13-05-2023 9:00';
$enddate_time='13-05-2023 9:30';
$start_timestamp=strtotime($startdate_time);

$end_timestamp=strtotime($enddate_time);


$minutes_diff= round(abs($end_timestamp- $start_timestamp) / 60,2);

echo $minutes_diff. " minutes ";

Output : 30 minutes



Leave a Reply

Your email address will not be published. Required fields are marked *