Skip to content

Instantly share code, notes, and snippets.

@scottnunemacher
Created March 10, 2023 18:56
Show Gist options
  • Save scottnunemacher/00e9e4bf91720e2d759cd1f95f916f2d to your computer and use it in GitHub Desktop.
Save scottnunemacher/00e9e4bf91720e2d759cd1f95f916f2d to your computer and use it in GitHub Desktop.
PHP - Find Years From Start Date
<?php
$startDate = new DateTime("1976-04-30");
$today = new DateTime('Y');
$interval = $startDate->diff($today);
echo $interval->y . " YEARS";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment