Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date field
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00472531
Message ID:
00472747
Vues:
26
>I am trying to move a string of characters into a date field in a foxpro table. The characters are in the format mmddyy in the call detail record i am pulling them from using substr on fixed width records. I tried using a val command on the characters, but got a data type mismatch. I was using a numeric field before and it worked just fine but the reason i need it to be date field is because when i try and sort the records, if they are numeric, 011501 (jan 15th, 2001) comes before 123100 (dec 31st 2000) which it obviously shouldn't. What can i do?

try creating a Date from them:

cStringDate = '123100'
dDate = DATE(VAL(RIGHT(cStringDate,2)),VAL(LEFT(cStringDate,2)),VAL(SUBST(cStringDate,3,2)))
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform