Лучший формат метки времени для CSV/Excel?

После активности нет скобок. Это должно быть:

public class Main extends Activity {

Вы используете ; после окончания ваших onCreate и onOptionsItemSelected. Вы не используете ; в конце ваших методов.

102
задан 29 April 2009 в 20:27
поделиться

4 ответа

Для второй точности, гггг-мм-дд ЧЧ: мм: сс Я должен сделать свое дело.

Я считаю, что Excel не очень хорош с долями секунды (теряет их при взаимодействии с COM-объектом IIRC).

93
ответ дан 24 November 2019 в 04:34
поделиться

The earlier suggestion to use "yyyy-MM-dd HH:mm:ss" is fine, though I believe Excel has much finer time resolution than that. I find this post rather credible (follow the thread and you'll see lots of arithmetic and experimenting with Excel), and if it's correct, you'll have your milliseconds. You can just tack on decimal places at the end, i.e. "yyyy-mm-dd hh:mm:ss.000".

You should be aware that Excel may not necessarily format the data (without human intervention) in such a way that you will see all of that precision. On my computer at work, when I set up a CSV with "yyyy-mm-dd hh:mm:ss.000" data (by hand using Notepad), I get "mm:ss.0" in the cell and "m/d/yyyy hh:mm:ss AM/PM" in the formula bar.

For maximum information[1] conveyed in the cells without human intervention, you may want to split up your timestamp into a date portion and a time portion, with the time portion only to the second. It looks to me like Excel wants to give you at most three visible "levels" (where fractions of a second are 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 the timestamp to be human-readable but you want it to be as accurate as possible, you might prefer just to store a big number (internally, Excel is just using the number of days, including fractional days, since an "epoch" date).


[1]That is, numeric information. If you want to see as much information as possible but don't care about doing calculations with it, you could make up some format which Excel will definitely parse as a string, and thus leave alone; e.g. "yyyymmdd.hhmmss.000".

17
ответ дан 24 November 2019 в 04:34
поделиться

Я полагаю, что если вы используете тип данных double , пересчет в Excel будет работать нормально.

4
ответ дан 24 November 2019 в 04:34
поделиться

Я бы предположил, что ISO-формат - хорошая идея. ( Статья в Википедии , также с информацией о времени)

-1
ответ дан 24 November 2019 в 04:34
поделиться
Другие вопросы по тегам:

Похожие вопросы: