Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save raihan-uddin/64d2f1e4b1cd95d5c8766c0a61d87483 to your computer and use it in GitHub Desktop.
Save raihan-uddin/64d2f1e4b1cd95d5c8766c0a61d87483 to your computer and use it in GitHub Desktop.
PHP : Date Difference
<?php
$date1 = '2009-12-20 20:12:10';
$date2 = '2009-12-24 12:12:10';
$ts1 = strtotime($date1);
$ts2 = strtotime($date2);
$seconds_diff = $ts2 - $ts1;
echo floor($seconds_diff/3600/24);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment