Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MMDD entry control
Message
 
 
To
30/07/1999 12:35:24
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00248248
Message ID:
00248255
Views:
12
Hmmm...

The first problem is interpreting what year the user is intending. If you can always assume the current year then you can do something like this.

You textbox (or two textboxes) need(s) to return an error for months outside of 1-12 and days outsides of 1-31. Once you do that, convert the char data into a date. Someting like

ldMikeDate = ctod(alltrim(str(year(date())))+"/"+lcMonth+"/"+lcDay)

A blank date will be returned from CTOD if the date is not valid (such as Feb 31/99). You could then give the user an error.

You would want to put some thought into the function that you use to ensure you don't introduces a y2k bug or a bug that incorrectly assumes the year the user intends.

If it were up to me I would do one of the following:
- get the user to enter the year
- display the full date after you have done the error checking to ensure the user knows what year the program has interpreted it as.


>I need a textbox control that allows entry of just month and day, No year. I do need the validation used for good dates (i.e. 2/29 only in a leap year). I can create a custom control using a ##/## picture and do all my own error checking, but would just as soon avoid this if possible.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform