Skip to content

Instantly share code, notes, and snippets.

@Marcoevich
Created June 27, 2018 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marcoevich/2acf22c8c901a36e5ee2660676bc0c10 to your computer and use it in GitHub Desktop.
Save Marcoevich/2acf22c8c901a36e5ee2660676bc0c10 to your computer and use it in GitHub Desktop.
Fix age calculation
$calculateAge = DateTime::createFromFormat('d/m/Y', $birthdate, $tz);
if($calculateAge) {
$age = $calculateAge->diff(new DateTime('now', $tz))->y;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment