I remember it like this:

The year has to be evenly divisible by 4, but not 100, unless it's divisible by 400.

So what does that mean?

1880 - leap year, divisible by 4

1881 - not a leap year, not divisible by 4

1884 - leap year, divisible by 4

1900 - not a leap year, divisible by 100 but not by 400

2000 - leap year, divisible by 400

So basically, the formula is:

function is_leap_year($year)

{

return (0 === ($year % 4)) &&

((0 !== ($year % 100)) || (0 === ($year % 400)));

}

In order, it reads:

If year is divisible by four AND either not divisible by 100 or divisible by 400, it's a leap year.

Take care,

Nik

http://www.bigaction.org/