Testing For Leap Year

The next total eclipse where I presently live is on April 8, 2024

God willing, I will still be alive to see the eclipse.

I was wondering if 2024 is a leap year.

Here's a quick way to determine if a year is a leap year;

echo %@doy[2024-12-31,4]

...which reutrns


...which means that 2024 is a leap year.

  • Like
Reactions: TEA-Time
Oct 18, 2009
Not quite. That's what Y2k was about. Centuries are only leap years if they are evenly divisible by 400, i.e., 1700, 1800 and 1900 were not leap years but 2000 was, but 2100 won't be.

Doesn't seem like a big deal but the Y2k problem was originally noticed in 1970 when calculations on 30-year mortgages were being done.

(Mortgages almost never are more than 30 years because beyond that the monthly payment is almost the same regardless of length, i.e. the difference between a 30 year vs. 40 year mortgage at the same interest rate might be $50 a month.)