An early proposal to use "yyyy-MM-dd HH: mm: ss" is fine, although I think Excel has a much more accurate time resolution than that. I find this post pretty believable (follow the thread and you will see a lot of arithmetic and experimenting with Excel), and if that is correct, there will be milliseconds. You can simply attack the decimal places at the end, that is, "yyyy-mm-dd hh: mm: ss.000".
You should be aware that Excel may not necessarily format the data (without human intervention) so that you can see all this accuracy. On my computer at work, when I set up CSV with the data "yyyy-mm-dd hh: mm: ss.000" (manually using Notepad), I get "mm: ss.0" in the cell and "m / d / yyyy hh: mm: ss AM / PM "in the formula bar.
To obtain the maximum information [1] transmitted in the cells without human intervention, you can divide your timestamp into a part of the date and a time part with the time part of only the second. It seems to me that Excel wants to give you no more than three visible "levels" (where fractions of a second is their own level) in any given cell, and you want seven: years, months, days, hours, minutes, seconds, and fractions of a second.
Or, if you don’t need a timestamp for human reading, but want it to be as accurate as possible, you may prefer to just keep a large number (internally, Excel uses only the number of days, including fractional days, starting from the date of the “era” )
[1] That is, numerical information. If you want to see as much information as possible, but don’t care about performing calculations with it, you can compose some format that Excel will definitely analyze as a string and thus be left alone; e.g. "Yyyymmdd.hhmmss.000".
John Y May 01 '09 at 3:52 2009-05-01 03:52
source share