Skip to content

Instantly share code, notes, and snippets.

@paulredmond
Created September 27, 2012 19:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulredmond/3795863 to your computer and use it in GitHub Desktop.
Save paulredmond/3795863 to your computer and use it in GitHub Desktop.
Get age with PHP's DateTime
<?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