|
Well, 1700, 1800 & 1900 were not leap years. 2000 is.
Your new calc won't work. Try for 1900.
Divide CCYY by 400
1900 not divisible by 400
If divisible then it is a leap year, else
Divide CCYY by 4
If divisible then it is a leap year, else it is not a leap year.
1900 is divisible by 4, but it's not a leap
year.
A subroutine from an old RPG program I just exhumed.
There is another rule that says that if the year is also divisible
evenly by 4000 (or 3600 - depending on where you find the information)
then it's not a leap year. It's referred to as a COMMON year - I wonder
what city the conference will be in ? :-).
Frankly I don't give a rat's a** what happens in the year 4000 (or
3600). I'm pretty sure we can assume that none of our programs will be
running at that point !
(Note that this is fine for dates AFTER the Gregorian calendar
reformation in 1752. For example, the years 1300, 1400, 1500 and 1700
were leap years).
C LEAPYR BEGSR LEAP YEAR TEST
C** Leap Year: If the year is divisible by 4 it is, but if it's
C** divisible by 100 it's not, unless it's also divisible by 400.
C** We're ignoring the "if it's divisible by 4000 (or 3600 ?)
C** then it's not a leap year" rule. :-)
C FOUR DIV 4 RES 40 LEAP YEAR
C MVR MVR4 40
C FOUR DIV 100 RES NOT LEAP YEAR
C MVR MVR100 40
C FOUR DIV 400 RES LEAP YEAR
C MVR MVR400 40
C MVR4 IFEQ *ZERO Div by 4
C MVR100 ANDNE*ZERO & not by 100
C MVR400 OREQ *ZERO or Div by 400
C MOVE *ON *IN31 LEAP YEAR
C ELSE else
C MOVE *OFF *IN31 NOT LEAP YEAR
C ENDIF
C ENDSR
Also a couple of references:
http://www.digtl.com/leapyr.htm
http://wwwcn.cern.ch/~mcnab/n/Cal/README.cal.txt
Neil Palmer AS/400~~~~~
NxTrend Technology - Canada ____________ ___ ~
Thornhill, Ontario, Canada |OOOOOOOOOO| ________ o|__||=
Phone: (905) 731-9000 x238 |__________|_|______|_|______)
Cell.: (416) 565-1682 x238 oo oo oo oo OOOo=o\
Fax: (905) 731-9202 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mailto:NPalmer@NxTrend.com AS/400 The Ultimate Business Server
http://www.NxTrend.com
> -----Original Message-----
> From: VENU YAMAJALA [SMTP:venu_yamajala@goodyear.com]
> Sent: Wednesday, August 26, 1998 12:21 PM
> To: MIDRANGE-L@midrange.com
> Subject: Leap Year
>
> Hi All,
>
> I want to know the fool-proof method of determining the leap year
> technique. My earlier logic was :
>
> Divide CCYY by 400.
> If divisible then it is leap year, else
> Divide CCYY by 100.
> If divisible then it is leap year, else
> Divide CCYY by 4.
> If divisible, then it is leap year, else it is not a leap year.
>
> But this is not working for years 1900, 1800, 1700, 2100...etc.
> Sometime back
> someone in a meeting pointed out that though 1900...etc are divisible
> by 100, 4
> they are not leap years!!! I heard someone saying that for every 400
> turns of
> the century (means years with 1600, 2000, 2400...etc), they are leap
> years and
> all other 100s are not (1900, 1800..etc). With this variation in mind,
> I am
> coming out with a new algorithm that says :
>
> Divide CCYY by 400.
> If divisible then it is a leap year, else
> Divide CCYY by 4
> If divisible then it is a leap year, else it is not a leap year.
>
> I want to know from the list, whether this new variation is the
> fool-proof technique. If not, I would like to know the one.
> Thanx in advance for any suggestions.
>
> Rgds
> Vg
>
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.