Last active
December 12, 2015 09:39
-
-
Save ryo-utsunomiya/4753145 to your computer and use it in GitHub Desktop.
calculate your birthday using PHP's DateTime class
This file contains hidden or 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 | |
$your_birthday = '';//type your birthday here e.g.:'2013/05/11' | |
$today = new DateTime(); | |
$birthday = new DateTime($your_birthday); | |
$interval = $today->diff($birthday, true); | |
echo $interval->format('your birthday is %m months and %d days ahead'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment