Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Date format that is guaranteed to be recognized by Excel

We're exporting our analytics reports in various formats, among them CSV. For some clients this CSV finds it's way into Excel.

Inside the CSV file one of the columns is a Date, for example

"Start Date","Name"
"07-04-2010", "Maxim"

Excel has trouble parsing this date format, obviously depending on the Locale of the user. Is "07" is the day or the month...

Could you recommend some textual format for a Date field that excel will not have trouble parsing? I'm aiming at the most fail safe option possible. I would settle for some escape sequence that will cause excel to avoid parsing the text in the column altogether.

Thanks for helping, Maxim.

like image 766
Maxim Veksler Avatar asked Apr 07 '10 11:04

Maxim Veksler


People also ask

What is the default format of date in Excel?

If the format is changed to d-mmm-yyyy, the date becomes 1-Jan-2021. We can change the date format in Excel either from the “Number Format” of the “Home” tab or the “Format Cells” option of the context menu. In Excel for Windows, 1900 is the default date system.

Why are dates not being Recognised in Excel?

The most likely problem is that the dates are text not numbers. Try referencing one of the date cells with the formula =ISTEXT(A10) where A10 is one of the problem cells. If the result of the formula is TRUE you know you have the wrong data type, text not numbers.

How do you make Excel recognize dd mm yyyy?

First, pick the cells that contain dates, then right-click and select Format Cells. Select Custom in the Number Tab, then type 'dd-mmm-yyyy' in the Type text box, then click okay.


1 Answers

You have two options. Go with the month as a string and the year as 4 digits, or use ISO formatting: yyyy-mm-dd.

like image 143
David Avatar answered Sep 23 '22 22:09

David