Last active
September 17, 2019 16:58
-
-
Save PogHallam/1194209ffa62097e16990f50f383dd09 to your computer and use it in GitHub Desktop.
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
/** | |
* Given a timestamp, return true if it is a leap year. | |
* | |
* @param int $timestamp A unix timestamp. | |
* | |
* @return bool | |
*/ | |
function is_leap_year( int $timestamp ): bool { | |
return (bool) date( 'L', $timestamp ); | |
} | |
/** | |
* Given a timestamp, return true if it is February in a leap year. | |
* | |
* @param int $timestamp | |
* | |
* @return bool | |
*/ | |
function is_leap_february( int $timestamp ): bool { | |
return is_leap_year( $timestamp ) && date( "m", $timestamp ) === '02'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment