Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Determining Dates (again)
Message
 
À
19/09/2008 17:06:46
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01349136
Message ID:
01349139
Vues:
13
>I'm playing around with trying to determine if a character string is actually a date. The only way dates come into this is CCYYMMDD, so it makes it a little easier. I know this isn't good enough to exclude all non-dates from being converted. What else can I do?
>
>CASE ;
>	BETWEEN(VAL(SUBSTR(m.FormatFieldValue,1,4)),1900,2050) ;
>	AND BETWEEN(VAL(SUBSTR(m.FormatFieldValue,5,2)),1,12) ;
>	AND BETWEEN(VAL(SUBSTR(m.FormatFieldValue,7,2)),1,31)
>	oDetails.FieldVal = ConvertFormat('D8',m.FormatFieldValue)
>
Make sure you are in a try..catch structure. If the conversion throws an error, you know your date was screwed.
____________________________________

Don't Tread on Me

Overthrow the federal government NOW!
____________________________________
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform