Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dates and nuts
Message
De
14/09/2001 11:04:44
 
 
À
14/09/2001 10:34:25
Mark Hall
Independent Developer & Voip Specialist
Keston, Kent, Royaume Uni
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00556454
Message ID:
00556500
Vues:
15
>>I need to validate web data which is by default type string. The fields which are most difficult to validate are DATE type. I have written code over the years to validate such strings but I never felt satisfied that I was thorough. does anyone have any code suggestions for this validation. what I am interested in is strictly a valid date.
>>
>>9/14/01
>>09/14/01
>>09/14/2001
>>01/14/09
>>09-14-01
>>09-14-2001
>>09.14.01
>>
>>and on and on
>>
>>Thanks
>>
>>Glenn
>
>Probably not what you want to hear, but here it is anyway.
>
>The simplest (but maybe not the most comprehensive) answer that I have is to use the VFP CTOD() function. It will certainly handle all of the variations that you have given as examples.

It will handle all variations, but may give incorrect results for the date stated as 01/14/09. In VFP I don't see a date format 'yy/dd/mm', if you pass it as is (with Set Date American), it will return {01/14/2009}.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform