Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date problem with APPEND FROM csv file
Message
From
09/09/2016 19:47:30
 
 
To
08/09/2016 21:08:31
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01640585
Message ID:
01640672
Views:
44
>>>>I'm developing have a little utility that imports data from .CSV files. I have problems with some dates. I have set:
>>>>
>>>>SET DATE BRITISH
>>>>SET CENTURY ON
>>>>
>>>>Dates come in british form (dd/mm/yyyy), they are NOT enclosed in quotation marks, they arrive to date type fields. After the APPEND FROM these dates suffer changes:
>>>>
>>>>CSV => VFP Cursor
>>>>16/05/1968 => 16/05/2019
>>>>19/06/2011 => 19/06/2020
>>>>02/04/1973 => 04/02/1973
>>>>11/08/2015 => 08/11/2015
>>>>04/05/1938 => 05/04/1938
>>>>26/07/2016 => 26/07/2020
>>>>22/05/2004 => 22/05/2020
>>>>24/03/2015 => 24/03/2020
>>>>13/09/1980 => 13/09/2019
>>>>16/05/1963 => 16/05/2019
>>>>
>>>>I tried changing to SET DATE AMERICAN and it becomes worst, the dates which previously are converted to end in 2020 appears blank.
>>>>
>>>>Does anyone have an idea?
>>>
>>>You might want to look at SET CENTURY TO xx ROLLOVER yy and SET STRICTDATE. But you're seeing some weird results, I'm not sure they would apply in your case.
>>>
>>>Some settings such as SET CENTURY are scoped per data session.
>>>
>>>If the above don't help then I think Thomas has the right idea, parse the input file, perhaps use an unambiguous date format such as {^2016-09-10}.
>>
>>
>>Thank you for your advice, but I have no way to ask the csv provider to change the csv file.
>
>I see that others have reported the same issue. It seems that if you append type delimited instead of csv, it works.

I fixed it by first using charatecr fields ans then converting those fields into date type, by extracting the dd, mm, and yyyy parts ans then using the DATE(yyyy, mm, dd) function.

Thank you all for helping me.
Previous
Reply
Map
View

Click here to load this message in the networking platform