Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ucbvax!hplabs!hplabsb!davis
From: davis@hplabsb.UUCP
Newsgroups: comp.misc
Subject: Re: Gregorian Calendar (was: Sorting by date)
Message-ID: <4419@hplabsb.UUCP>
Date: Wed, 25-Nov-87 18:14:14 EST
Article-I.D.: hplabsb.4419
Posted: Wed Nov 25 18:14:14 1987
Date-Received: Sun, 29-Nov-87 06:08:47 EST
References: <11630005@hpsmtc1.HP.COM> <3013@phri.UUCP> <501@ncspm.ncsu.edu> <3021@phri.UUCP>
Reply-To: davis@hplabs.hp.com (Jim Davis)
Organization: Hewlett-Packard Labs, Palo Alto, CA
Lines: 23
Keywords: Gregorian calendar, 4000 year correction.
Summary: leap = (yr%4)==0 && (yr%4000)!=0 && ( (yr%400)==0 || (yr%100)!=0)

roy=article <3021@phri.UUCP> roy@phri.UUCP (Roy Smith)
roy>		Unix's "cal" command knows about the "if it's divisible by 4,
roy>	except if it's divisible by 100 but not by 400" rule.  Try "cal 2 2100"
roy>	(or "cal 9 1752" for trivia buffs).  I don't suppose those $2.99 LCD
roy>	clock/calendars are so sophisticated, however.

    Isn't there a 4000 year correction?  So that the rule reads:

    It's a leap year if its divisible by 4,
	except if it's divisible by 100,
	    except if it's divisible by 400,
		except if it's divisible by 4000.

    For the more C minded: (since I've left the english ambiguous.)
	leap = (yr%4)==0 && (yr%4000)!=0 && ( (yr%400)==0 || (yr%100)!=0);
cal(UTIL) doesn't seem to get it right in "cal 2 4000".
I'll have to write in a complaint ;-)

----------------------------------
		Jim Davis (James W Davis)
Email:		{any_of_the_biggies} !hplabs!davis
Arpa/Domain:	davis@hplabs.hp.com
----------------------------------