Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dates and nuts
Message
 
 
À
14/09/2001 10:24:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00556454
Message ID:
00556460
Vues:
16
Hi!

Something like following (created on the fly and did not tested it, but shows the idea)
old___error = on("error")
on error llError = .T.
llError = .F.

nMonth=val(strDate)
nDay=val(substr(strDate,len(allt(str(nMonth)))+1))
nYear=val(substr(strDate,len(allt(str(nMonth)))+1+len(allt(str(nDay)))+1))

if nYear<100
  nYear = nYear + 100*(SET("CENTURY",1)+ ;
    iif(nYear<SET("CENTURY",2),1,0) )
endif

dDate = date(nYear,nMonth,nDay)

on error &old___error
if llError
  && invalid date ...
endif
>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
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform