Created
May 3, 2014 01:08
-
-
Save madeinnordeste/f55d8578c32b16c4a6ba to your computer and use it in GitHub Desktop.
PHP - Datetime Diff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$from = new DateTime('0000-00-00 00:00:00'); | |
$to = new DateTime('now'); | |
$interval = $to->diff($from); | |
//2011 years, 4 months, 5 days, 11 hours, 13 minutes, 49 seconds | |
echo $interval->format('%Y years, %m months, %d days, %H hours, %i minutes, %s seconds'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment