Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date Validation
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01196812
Message ID:
01196845
Views:
10
How about something like this?
lcString = "abc"
ldTest = CTOD(lcString)
? DTOC(ldTest) = lcString && True if lcString is a valid date string
>Is there any way to test if a string will evaluate to a valid date without parsing the string? I tried something like TYPE(CTOD(lcMyString)) and other variations on this theme but nothing seems to work. The empty string (" / / ") must be accepted as a valid date also.
>
>I can't find anything that will work though it seems that there should be some way to get VFP to tell you if a string will be a valid date, but I can't find anything.
>
>I tried the following but it does not work:
> lcString = "abc"
> ldTest = CTOD(lcString)
>because VFP returns {//} which is not acceptable, since the input may be an empty date, but input of an empty date is acceptable so there would be no way to distinguish between input of a valid empty date or an invalid date.
>
>Thanks.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform