Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Leap years
Message
 
To
08/07/1998 16:06:12
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00115008
Message ID:
00115466
Views:
12
>>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}"))
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform