且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将Excel中的日期转换为ISO 8601格式

更新时间:2023-02-03 21:54:03

基本功能是:

  = TEXT(A1, yyyy-mm-ddThh:MM:ss)

使用此选项将Excel日期列转换为单独的ISO8601日期列。接下来,将ISO  8601列复制到原件上(特殊粘贴:仅粘贴值)。
删除计算出的ISO8601列,这些列现在已包含垃圾,因为Excel在ISO 8601日期处发生错误。



您现在具有转换后的CSV或TSV没什么。只需另存为原始格式,然后忽略愚蠢的Excel关于它不是其本机文件格式的抱怨,以及如何通过另存为CSV文件以某种方式丢掉,并尽量不要考虑微软被盗的时间那个愚蠢的对话框。


I am trying to save a date format in YYYY-MM-DD, for example, 2014-09-01 as a CSV file, but the format reverts back to the M/D/YYYY format when I do.

I tried converting the date as a string in Excel, but every time I open up the CSV file, it's back to the M/D/YYYY format. I need the ISO 8601 date format to be saved in a CSV file. How do I go about doing so?

The basic function is:

=TEXT(A1,"yyyy-mm-ddThh:MM:ss")

Use this to convert your Excel date columns to separate ISO 8601 date columns. Next, copy the ISO 8601 columns onto the originals (paste special: paste values only). Delete the calculated ISO 8601 columns which now have garbage in them because Excel sucks at ISO 8601 dates.

You now have a transformed CSV or TSV or whatnot. Just save as the original format and ignore the stupid Excel whining about it not being its native file format and how you are going to "lose out" somehow by saving as CSV file and try not to think about the hours of your life Microsoft has stolen with that dumb dialog.