Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Determining Dates (again)
Message
De
20/09/2008 17:16:27
 
 
À
19/09/2008 20:16:50
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:
01349240
Vues:
15
>>>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)
>>>
>>
>>Seems to me you could just use CTOD() with an appropriate SET DATE. If you get a date back, it's good. If you get the empty string, it's no goo.
>
>Not really, because 01/01/01 is a date, but not one I want. I guess I could do the same thing as you suggested and put a BETWEEN with a date range though to handle that.

Yeah, that would work.

Tamar
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform