Skip to content

Instantly share code, notes, and snippets.

@vrushank-snippets
Created December 12, 2012 07:39
Show Gist options
  • Save vrushank-snippets/4265833 to your computer and use it in GitHub Desktop.
Save vrushank-snippets/4265833 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