Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems appending datetime field from a delimited text
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00521684
Message ID:
00521699
Views:
15
>>
>>Have you looked at what the text is for the date/time field? Unlike the a date field where the data is stored as a string in the format YYYYMMDD, a date/time value is probably stored in the same format a a FILETIME structure (2 DWORDS), since it, like the FILETIME structure are 8 bytes. If the text is in a readable date time format that can be converted using the CTOT() function, it's probably the easiest way and your best bet.
>
>Hi George,
>
>Here is part of one record as it appears in the text file (datetime field is the second-last one shown).
>
>"A","1240","1","1","00029","16:14:17","06/16",2001/06/16 16:14:17,25.49,
>
>Are you suggesting that when I bring these records in I should bring in each record seperately? I'm not opposed to doing that, and that may be what I end up having to do ---> however I find it kinda weird that when I append records to the table (with the datetime field as shown above) via the VFP menu selections (Table/Append Records) it brings in all the fields OK, but when I do it programatically, all fields are OK, with the exception of the datetime fields - which are empty. Thanks for your assistance.

Nope, bring the date/time field in as character. Since I've never used the delimited format, I don't know if you'd have to either: A. Have an additional field for the real date/time; or B. Do an ALTER TABLE to add it. In either event all that would have to do done then is a REPLACE ALL < date/time field > WITH CTOT(< character date/time field >). AFAIK, there no way to do something like you can with dates: Use the the VBScript.RegExp object to change the format from something like 06/20/2001 to 20010620 using FILETOSTR() and STRTOFILE().
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform