Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date Validation
Message
 
À
17/02/2007 10:19:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01196812
Message ID:
01196845
Vues:
11
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform