Created
September 27, 2012 19:16
-
-
Save paulredmond/3795863 to your computer and use it in GitHub Desktop.
Get age with PHP's DateTime
This file contains 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 | |
$birthday = '01/01/1970'; | |
$age = DateTime::createFromFormat('m/d/Y', $birthday) | |
->diff(new DateTime('now')) | |
->y; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment