Board index » delphi » Leap Year

Leap Year

I am converting an old legacy COBOL program to Delphi.

It uses a module to convert dates to and from a "day number" using 1st
Jan 1900 as day number 1.

When I checked my Delphi code (using the inbuilt Date functions -
EncodeDate() and DecodeDate() ) I discovered that the COBOL app had
1900, 2000 and 2001 as leap years. But Delphi only has 2000 as a leap
year. Both 1900 and 2001 error.

I then checked Borland QuattroPro, and it also excludes 1900 and 2001.

I then checked Microsoft Excel, and it includes 1900 and 2001 as leap
years.

So, which is correct? Was 1900 a leap year? Will 2001 be a leap year?
==
Bob Small

 

Re:Leap Year


Quote
>It uses a module to convert dates to and from a "day number" using 1st
>Jan 1900 as day number 1.

>When I checked my Delphi code (using the inbuilt Date functions -
>EncodeDate() and DecodeDate() ) I discovered that the COBOL app had
>1900, 2000 and 2001 as leap years. But Delphi only has 2000 as a leap
>year. Both 1900 and 2001 error.

>I then checked Borland QuattroPro, and it also excludes 1900 and 2001.

>I then checked Microsoft Excel, and it includes 1900 and 2001 as leap
>years.

>So, which is correct? Was 1900 a leap year? Will 2001 be a leap year?

Leap year is a year containing 366 days, or one day more than an ordinary
year to offset the difference in length between the ordinary year and the
astronomical year.

In practice, it is every year whose number is exactly divisible by four
(e.g. 1948), except centenary years not exactly divisible by 400.  Thus,
1900 is *not* a leap year as it is not evenly divisible by 400 and it is
a centenary (divisible by 100) year.

The year 2000 *is* a leap year.  2001 is definately not a leap year.  Borland
is correct, Microsloth is not.

************************************
*           The Nomad              *
*        tno...@digital.net        *
************************************

Re:Leap Year


Quote
r...@melbpc.org.au (Robert Small) wrote:
>I am converting an old legacy COBOL program to Delphi.
>It uses a module to convert dates to and from a "day number" using 1st
>Jan 1900 as day number 1.
>When I checked my Delphi code (using the inbuilt Date functions -
>EncodeDate() and DecodeDate() ) I discovered that the COBOL app had
>1900, 2000 and 2001 as leap years. But Delphi only has 2000 as a leap
>year. Both 1900 and 2001 error.
>I then checked Borland QuattroPro, and it also excludes 1900 and 2001.
>I then checked Microsoft Excel, and it includes 1900 and 2001 as leap
>years.
>So, which is correct? Was 1900 a leap year? Will 2001 be a leap year?
>==
>Bob Small

Well, 2001 is not going to be a leap year. Guaranteed. I know that
leap years have to evenly divisible by 4. I also seem to remember that
century years are not leap years unless they are evenly divisible by
400. That would make 1600 & 2000 leap years, but not 1700, 1800 or
1900.

hth

scott
sande...@ix.netcom.com

Re:Leap Year


Quote
In article <3tpgb5$...@wombat.melbpc.org.au> r...@melbpc.org.au (Robert Small) writes:

>I then checked Borland QuattroPro, and it also excludes 1900 and 2001.

>I then checked Microsoft Excel, and it includes 1900 and 2001 as leap
>years.

>So, which is correct? Was 1900 a leap year? Will 2001 be a leap year?

2000 will be a leap year. 1900 was not. 2001 will definetely not be a
leap year.

Will this be the end of Microsoft? (Sorry, couldn't resist it...)

Cheers,
Anders

----------------------------------------------------------------------
The Delphi Hackers' Corner  -       http://www.it.kth.se/~ao/DHC/
      The MAD Corner        -     http://www.it.kth.se/~ao/mad.html
 My Own Corner of the Web   -         http://www.it.kth.se/~ao/
      Anders Ohlsson        -  a...@sto.foa.se (work) a...@it.kth.se (fun)

Other Threads