Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why year 1900 is not a leap year? 3

Status
Not open for further replies.

ajq98

Programmer
Jun 10, 2003
9
SA
Does anybody know why Visual Foxpro not recognize year 1900 as a leap year?
 
Because 1900 wasn't a leap year. A leap year is defined as any year divisible by 4 except centenary years not divisible by 400.

1900 is not divisible by 400 so it is not included. The year 2000 is divisible by 400 so it counts.

Andy
 
Yes - because it isn't!

While everyone "knows" that there is a leap year every four years, there are some "fixes" to this general run to keep everything in astronomical sync.

The additional rules are:
1) Except every 100 years on the century it's not a leap year.
2) Except every 400 tears on the century, when it is.

So 1900 (and 1700 and 1800) isn't a leap year but 2000 (and 1600) was!

Rick
 
Hi,

Yep, it's because it isn't. VFP is correct there. The rule put down by the Gregorian (as opposed to the old Julian) calendar is:

1. Every year divisible by 4 is leap year, EXCEPT...
2. If it is divisible by 100 it is not leap year, unless it is divisible by 400.

Thus 2000 IS leap year. 2001,2002,2003 are NOT. 2004 will be. 1900 is NOT, along with 1800 and 1700.

Cheers,

Bill vV
 
Funny thing leap years, the normal rule is that as long as the year is exactly divisible by 4 then it's a leap year; however when it comes to century years another rule has to be applied... the year must also be divisible by 40; don't remember exactly why but it has something to do with a year not really being 365 days and so every couple of years we have to catch up.
 
Thanks to everybody for the valuable information you provided here. I am still confused that when I have date information in Microsoft Excel and I convert every column as a text, why does Excel give serial # 60 to 2/29/1900? As you know that Excel starts assigning serial # to each date starting from 1/1/1900 to 12/31/2999. Based on this inofrmation I wrote a function that converts that serial # back to date just by adding that (number - 1) in 1/1/1900. This function works fine till 1/28/1900 but after that date it gives one future date of the actual date. That's why I was wondering why Excel considers 1900 a leap year and VFP does not? Any comments on this please
 
The story I heard is that when Lotus developed 1-2-3, they did not realize that century years must be divisible by 400 to be leap years.
Lotus 1-2-3 became the spreadsheet standard. In order to be compatible with Lotus, all the rival spearsheets had to conform to this error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top