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

Click here to load this message in the networking platform