Re: detecting leap years?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 19, 2018 at 8:34 PM, Jeffry Killen <jekillen@xxxxxxxxxxx> 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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux