Reputation: 51
I have an array list which looks like below:
data = new ArrayList<String[]>();
data.add(new String[] {"Date","Day_Of_Week"});
data.add(new String[] {"2011-1-10","xyz"});
data.add(new String[] {"2011-1-11","xyz"});
data.add(new String[] {"2011-1-12","xyz"});
Then, I write the data from the above ArrayList to a CSV file using following code:
String csv = "D:\\Output.csv";
CSVWriter writer = new CSVWriter(new FileWriter(csv));
writer.writeAll(data);
writer.close();
csvReader.close();
If I open my Output.csv
file, the format of the date is:
1/10/2011
1/11/2011
1/12/2011
Can anybody help why this is happening? Does CSV file automatically change the format of the date when writing it int the file?
Upvotes: 0
Views: 855
Reputation: 398
Try to open file in another program. For example notepad. Excel can show you reformat view.
Upvotes: 2