>Hi Jim,
>Fox knows which years are leap years...
>FUNCTION LeapYear
>LPARAMETER nYear
>RETURN CTOD("29/2/" + LTRIM(STR(m.nYear))) <> {}
David,
You're right that fox knows the leap years. However, as often happens you assumed that all users will have the same SET DATE in effect that you use. You're code revised to handle the set dates would be;
FUNCTION LeapYear
LOCAL lcDate, llRet
lcDate = SET("DATE")
SET DATE AMERICAN
LPARAMETER nYear
llRet = NOT EMPTY(CTOD("2/29/" + LTRIM(STR(m.nYear))))
SET DATE &lcDate
RETURN llRet
We can't always assume that the date setting at runtime will be the same as we use on our own machines. CTOD() is affected by the set date command.