Re: Year 2000 leap year?
Posted in 1997
* years divisible by 4 are leap years, EXCEPT for the years which are * divisible by 400, which are NOT leap years. Therefore, 2000 should NOT * be a leap year. * However, I was told (by a very unreliable source who sounded as though * he heard it from a reliable source) that 2000 was an exception, * allegedly to correct a problem with the Julian calendar. I have not * seen this "news" anywhere else, so if you know, please also respond by * e-mail as I am remiss in checking the newsgroup on a regular basis. You seem to have it a little off. It's divisible by 4 and (not divisible by 100 and divisible by 400). Here is a code snippet if that's unclear: MAIN DEFINE CurrentYear SMALLINT, IsLeapYear SMALLINT, IsDiv4 SMALLINT, IsDiv100 SMALLINT, IsDiv400 SMALLINT, String CHAR(80) IF NUM_ARGS() <> 1 THEN LET String = ARG_VAL(0) DISPLAY "usage: ", String CLIPPED, " [year]" EXIT PROGRAM END IF LET CurrentYear = ARG_VAL(1) LET IsLeapYear = FALSE LET IsDiv4 = NOT (CurrentYear MOD 4) -- True/False divisible by 4 LET IsDiv100 = NOT (CurrentYear MOD 100) -- True/False divisible by 100 LET IsDiv400 = NOT (CurrentYear MOD 400) -- True/False divisible by 400 IF IsDiv4 THEN IF NOT IsDiv100 THEN LET IsLeapYear = TRUE ELSE IF IsDiv400 THEN LET IsLeapYear = TRUE END IF END IF END IF END MAIN HTH, ----------------------------------------------------------------------------- Robert Minter Data Systems Support Senior Software Engineer A Client Technologies Company E-Mail: rob@dssmktg.com Tel: 714.771.0454 Fax: 714.771.3028 #include <std_disclaimer.h> http://www.dssny.com