Information générale
Catégorie:
Codage, syntaxe et commandes
>>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement