Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Testing For Leap Year

Aug
1,916
68
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;

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

...which reutrns

Code:
366

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

Joe
 
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.)
 
Code:
echo %@doy[2000-12-31,4]
returns
Code:
366

Code:
echo %@doy[2100-12-31,4]
returns
Code:
365

A leap year has 366 days.

A non-leap year has 365 days.

Joe
 
Back
Top