Re: detecting leap years?
| From: | Aziz Saleh | Date: | Sat, 20 Jan 2018 01:36:51 +0000 |
| Subject: | Re: detecting leap years? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-326362@lists.php.net to get a copy of this message | ||
On Fri, Jan 19, 2018 at 8:34 PM, Jeffry Killen <jekillen@prodigy.net> wrote:
> Is there a function for detecting leap years?
>
> I have developed a calendar generation module
> that relies on javascript to let it know that a year
> to be rendered in html markup is a leap year, so
> it can add an extra day to February.
>
> When the host html first loads, the module defaults
> to the current year. So it doesn't get to the point that
> javascript can decide and return its judgment.
> I am using getDate to determine the current year.
> I need to determine if a current year is a leap year.
>
> I have written one for javascript, if there isn't a
> built in function in php I can translate the js to php.
>
> Thank you for time and attention;
>
> Jeff k
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
function is_leap_year($year) {
return ((($year % 4) == 0) && ((($year % 100) != 0) || (($year % 400) == 0)));}
Source:https://davidwalsh.name/checking-for-leap-year-using-php