Saving to CSV in Excel loses regional date format

前端 未结 8 1925
北海茫月
北海茫月 2020-12-17 15:59

I have a .xls I need to convert to .csv

The file contains some date columns. The format on the date is \"*14/03/2001\" which, according to Excel means the date respo

8条回答
  •  感动是毒
    2020-12-17 16:25

    You need to do a lot more work than 1. click export 2. Open file.

    I think that when the Excel CSV documentation talks about OS and regional settings being interpreted, that means that Excel will do that when it opens the file (which is in their "special" csv format). See this article, "Excel formatting and features are not transferred to other file formats"

    Also, Excel is actually storing a number, and converting to a date string only for display. When it exports to CSV, it is converting it to a different date string. If you want that date string to be non-default, you will need to convert your Excel cells to strings before performing your export.

    Alternately, you could convert your dates to the number value that Excel is saving. Since that is a time code, it actually will obey OS and regional settings, assuming you import it properly. Notepad will only show you the 10-digit number, though.

提交回复
热议问题