Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Leap years
Message
 
À
08/07/1998 16:06:12
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00115008
Message ID:
00115466
Vues:
13
>>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.
Dragan,

One oops the month comes before the day in strict date format, so it should be;

return !empty(Eval("{^"+ STR(YEAR(m.dCheck_date),4)+"/29/02}"))
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform