Excel-将JavaScript/Unix时间戳转换为日期

Excel-将JavaScript/Unix时间戳转换为日期

问题描述:

我想知道如何在Excel中将时间戳转换为日期.

I'm wondering how to convert a timestamp to a date in Excel.

JavaScript时间戳:

JavaScript timestamp:

1486812409161

1486812409161

Unix时间戳

1486812409

1486812409

哪些Excel函数/公式可以转换为类似的内容:

What Excel function / formula can convert to something like:

2/11/2017 11:26 AM(或任何可读的日期)

2/11/2017 11:26 AM (or any human readable date)

我确实看到了此答案,但我无法使它对我有用(在Mac OS X上/Excel 2011).

I did see this answer, but I can't get this to work for me (on Mac OS X / Excel 2011).

当我创建一个新的单元格并将其值设置为以下公式时:

When I create a new cell and set it's value to the following formula:

= (MsValueCellReference / 86400000) + DATE(1970,1,1)

结果是:41315.47696

Excel很高兴在日期和数字之间进行转换.但是,faict不能总是正确地猜出您想看到两个.

Excel is pretty happy to interconvert between dates and numbers, as you noticed. However, afaict, it can't always guess correctly which of the two you want to see.

因此,要确保将值呈现为日期,您需要打开设置单元格格式"对话框,转到第一个标签数字",然后将单元格的格式类别设置为日期类型之一.

So, to ensure that a value is rendered as a date, you'd need to open the Format Cells dialog, go to the first tab Number, and set the cell's format Category to one of the Date types.