Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to validate dates? (month and day only)
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00457589
Message ID:
00457593
Views:
21
>A user enters a day in a spinner. They then choose a month from a combobox. They do not enter a year. Is there an
>easy way to tell if the month/day combination is valid?

You could do:
IF EMPTY(CTOD(STR(month,2)+"/"+STR(day,2)"))
  * invalid
ELSE
  * valid
ENDIF
You only need the month and day to make a valid date (assumes current year).
You may have to special checking to handle Feb. 29.

Note that this is SET DATE format specific.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform