Created
March 10, 2023 18:56
-
-
Save scottnunemacher/00e9e4bf91720e2d759cd1f95f916f2d to your computer and use it in GitHub Desktop.
PHP - Find Years From Start Date
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 | |
$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