Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: leap year

RE: leap year

From: Lex de Haan <lex.de.haan_at_naturaljoin.nl>
Date: Tue, 24 May 2005 16:15:03 +0200
Message-Id: <20050524141504.10F038010F76@smtp-out1.tiscali.nl>


well, for a start, here is the definition (with thanks to google): In the Gregorian calendar, which is the calendar used by most modern countries, the following rules decides which years are leap years:

  1. Every year divisible by 4 is a leap year.
  2. But every year divisible by 100 is NOT a leap year
  3. Unless the year is also divisible by 400, then it is still a leap year.

so in the first step, I would round the lower bound YYYY value up to the next multitude of 4,
round the upper bound YYYY value down to the previous multitude of 4 -- this gives you a starting value.

then, in a similar way, subtract the multitudes of 100; and finally, add a correction for the multitudes of 400.

kind regards,

Lex.  



Steve Adams Seminar http://www.naturaljoin.nl/events/seminars.html

-----Original Message-----

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Inessa Weiner
Sent: Tuesday, May 24, 2005 16:01
To: oracle-l_at_freelists.org
Subject: leap year

Hi,

I need to write a PL/SQL function to
show how many times the leap year occurred between two dates. The maximum range between dates is 10 years.

Please help.
Thanks,
Inessa.

--

http://www.freelists.org/webpage/oracle-l

--

http://www.freelists.org/webpage/oracle-l Received on Tue May 24 2005 - 10:19:53 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US