Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Leap years
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00115008
Message ID:
00115023
Vues:
16
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform