Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Leap years
Message
De
08/07/1998 16:06:12
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
07/07/1998 14:48:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00115008
Message ID:
00115458
Vues:
15
>Here's a quick and dirty function for determining leap years:
>
>Function LeapYear
>* dCheck_date is some date in the year you wish to check
>Parameters dCheck_date
>local nYear
>m.nYear = STR(YEAR(m.dCheck_date),4)
>return !empty(CTOD("02/29/"+m.nYear))

That's Set Date dependent (in my case it would return empty for all millenia, for no years have 29 months here). We'd either have to do some internal Set Date (saving, setting, restoring), or use the new strict date syntax, like

return !empty(Eval("{^"+ STR(YEAR(m.dCheck_date),4)+"/02/29}"))

Works in VFP5.0, tested.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform