AndrewMozley
Programmer
I would like to read some dates in from a .csv file, and the user supplies these as e.g. “31/07/2012” which I would like to interpret as 31st July 2012. However I find that the yyyy field is interpreted as yy, so 2012 is being interpreted as the 20th year in this century. So I am reading these dates as 31st July 2020.
While investigating this, I have created a test csv file, date1.csv, and a test table, date1.dbf.
I execute these commands at the VFP prompt
My date1.csv file looks like this
and this is the result I get in date1.dbf (I have SET DATE LONG just for display purposes) :
So I am finding that the first (data) line in date1.csv is being interpreted as dd/mm/yy and the second is being interpreted as mm/dd/yyyy – which is different!
Any idea why this is happening? I have got SET DATE BRITISH, SET CENTURY ON, and on my Control Panel | Regional options, I am using English, United Kingdom, with short date format dd/mm/yyyy.
It almost seems that VFP is only prepared to interpret an input date as British when it is really desperate, because the mm field is greater than 12 !
Any help greatly appreciated.
While investigating this, I have created a test csv file, date1.csv, and a test table, date1.dbf.
I execute these commands at the VFP prompt
USE date1.dbf
APPEND FROM date1.csv TYPE CSV
BROWSE LAST
APPEND FROM date1.csv TYPE CSV
BROWSE LAST
My date1.csv file looks like this
Code:
Date_1
"31/07/2012"
"03/04/2023"
and this is the result I get in date1.dbf (I have SET DATE LONG just for display purposes) :
Code:
31 July 2020
04 March 2023
So I am finding that the first (data) line in date1.csv is being interpreted as dd/mm/yy and the second is being interpreted as mm/dd/yyyy – which is different!
Any idea why this is happening? I have got SET DATE BRITISH, SET CENTURY ON, and on my Control Panel | Regional options, I am using English, United Kingdom, with short date format dd/mm/yyyy.
It almost seems that VFP is only prepared to interpret an input date as British when it is really desperate, because the mm field is greater than 12 !
Any help greatly appreciated.