Calculate difference between two dates using PHP

mins
<?php
  
// Declare two dates
$start_date = strtotime("2021-06-01");
$end_date = strtotime("2021-08-02");
  
// Get the difference and divide into total number of seconds 60/60/24 to get number of days
echo ""
. ($end_date - $start_date)/60/60/24;
?>

Difference between two dates: 62

I do not use cookies on this website

🍪🍪 What cookies?


Your privacy is important. That's why this website doesn't track visitors with fingerprinting, your IP address or cookies.


Web analytics data is your own. Reclaim it.

Gain back control with a privacy-focused web analytics platform (using a cookie-less architecture) from: Data Centurion.