/ Published in: PHP
URL: http://jrtashjian.com/blog/dont-hard-code-your-age/
Expand |
Embed | Plain Text
Comments
Subscribe to comments
You need to login to post a comment.
URL: http://jrtashjian.com/blog/dont-hard-code-your-age/
Subscribe to comments
You need to login to post a comment.
you can do this with one, much shorter, line of code
$yearsOld = floor(abs(mktime() - strtotime("March 17, 1982")) / 31536000);
subtracts the timestamp of the parsed birth date, from the current timestamp. It then divides that number by the number of seconds in a 365 day year. The result being the number of years between the 2 dates.