Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Leap years
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00115008
Message ID:
00115023
Views:
15
>Hello All,
>A simple question but one I have gone completelty blank on.
>
>How do I define a leap year?? I know that year % 4 returning a 0 is not enough. What's the rest??

The rules are a bit more complicated than that... but unless you deal with dates earlier than 1901 or later than 2099, you shouldn´t worry. In a fox-like pseudocode:

DO CASE
CASE if it´s divisible by 400
it´s a leap year (thus, 2000 is a leap year)
CASE it´s divisible by 100
it´s not a leap year (1900 and 2100 aren´t leap years)
CASE it´s divisible by 4
it´s a leap year (1996 and 2004 are leap years).
OTHERWISE
it´s not a leap year (1997, 1998 and 1999 aren´t leap years).
ENDCASE
Previous
Reply
Map
View

Click here to load this message in the networking platform