Skip to content

Instantly share code, notes, and snippets.

@balibali
Created May 10, 2010 06:54
Show Gist options
  • Save balibali/395767 to your computer and use it in GitHub Desktop.
Save balibali/395767 to your computer and use it in GitHub Desktop.
$ php -r "var_dump(date_diff(new DateTime('2010-05-10'), new DateTime('2010-03-19'))->format('%a'));"
string(2) "52"
$ php -r "var_dump(date_create('2010-05-10')->diff(date_create('2010-03-19'))->format('%a'));"
string(2) "52"
$ php -r "var_dump((strtotime('2010-05-10') - strtotime('2010-03-19')) / (60 * 60 * 24));"
int(52)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment