Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date Problem
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00480214
Message ID:
00480365
Views:
8
>George,
>
>They are:
>
>12/18/00
>01/18/01
>
>
>After I append in the data (SDF), they appear as:
>12/18/1900 and;
>01/18/0001
>
>with SET CENTURY ON
>
>K

VFP wants dates in the form YYYYMMDD; if you have WSH 2.0 or later, you can use the VBScript.RegExp object to perform this translation reading the file and rewriting it fixed:
oRegExp = CREATEOBJ('VBScript.RegExp')
oRegExp.Global = .T.
oRegExp.Pattern = '(dd)/(dd)/(dd)'
=STRTOFILE(oRegExp.Replace(FILETOSTR(cFileToImport),'20$3$1$2'),cTempFileName)
Now import cTempFileName and it'll work just fine, converting all the dates to the correct format.

If you're also receiving dates from 19xx in your import, this won't fix the problem; may need to pull in the dates as character strings in an intermediary file and convert them using DTOC() after the fact.
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
Previous
Reply
Map
View

Click here to load this message in the networking platform