跳到主要内容

如何在Excel中的日期和Unix时间戳之间转换?

Unix时间戳也称为时代时间或POSIX时间,在许多操作系统或文件格式中广泛使用。 本教程讨论的是Excel中日期和Unix时间戳之间的转换。

将日期转换为时间戳

将日期和时间转换为时间戳

将时间戳转换为日期

有关日期时间转换的更多教程...


箭头蓝色右气泡 将日期转换为时间戳

要将日期转换为时间戳,可以使用公式来计算。

选择一个空白单元格,假设单元格C2,然后键入此公式 =(C2-DATE(1970,1,1))* 86400 进入并按 输入 键,如果需要,您可以通过拖动自动填充手柄来应用此公式的范围。 现在,一系列日期单元已转换为Unix时间戳。
文档转换日期-unix-1


2 单击将时间转换为十进制小时、分钟或秒

转换时间 的特点 Kutools for Excel 可以帮助您快速将时间转换为十进制的小时、分钟或秒,并将结果放置在原始目的地或另一个目的地。

文档转换时间 1

箭头蓝色右气泡 将日期和时间转换为时间戳

有一个公式可以帮助您将日期和时间转换为Unix时间戳。

1.首先,您需要在1/1/1970单元格中输入协调世界时。 看截图:
文档转换日期-unix-2

2.然后键入此公式 =(A1- $ C $ 1)* 86400 进入细胞,按 输入 键,然后根据需要将自动填充手柄拖到带有此公式的范围内。 看截图:
文档转换日期-unix-3

Tips:在公式中,A1是日期和时间单元格,C1是您输入的通用坐标时间。


箭头蓝色右气泡 将时间戳转换为日期

如果您有转换为日期所需的时间戳列表,则可以执行以下步骤:

1.在时间戳列表旁边的空白单元格中,键入以下公式 =(((A1/60)/60)/24)+DATE(1970,1,1), 按 输入 键,然后将自动填充手柄拖到所需的范围。
文档转换日期-unix-4

2.然后右键单击使用公式的单元格,然后选择 单元格格式 从上下文菜单中,然后在弹出窗口中 单元格格式 对话框,在N下棕土 标签,点击 日期 ,在 产品分类 列表,然后在右侧部分中选择日期类型。
文档转换日期-unix-5

3。 点击 OK,现在您可以看到Unix时间戳已转换为日期。
文档转换日期-unix-6

笔记:

1. A1指示您需要的时间戳单元。

2.此公式还可以用于将时间戳序列转换为日期和时间,只需将结果格式化为日期和时间格式即可。

3.上述公式将10位数字转换为标准日期时间,如果您想在Excel中将11位数字,或13位数字,或16位数字转换为标准日期时间,请使用以下公式:

将 11 位数字转换为日期: =A1/864000+日期(1970,1,1)

将 13 位数字转换为日期: =A1/86400000+日期(1970,1,1)

将 16 位数字转换为日期: =A1/86400000000+日期(1970,1,1)

对于需要转换为日期时间的不同长度的数字,只需更改公式中除数的零个数即可正确得到结果。


相关文章:

  • 如何在Excel中从日期中删除时间?
    如果有一列带有时间戳的日期,例如2/17/2012 12:23,并且您不想保留时间戳,并且想要从日期中删除时间12:23,而只保留日期2年17月2012日。 如何在Excel中的多个单元格中快速删除日期中的时间?

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (27)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
How Define a Custom Date Format: yyyy-mm-dd hh:mm:ss

yyyy: Year with four digits.
mm: Month with two digits (01-12).
dd: Day of the month with two digits (01-31).
hh: Hour with two digits (00-23).
mm: Minute with two digits (00-59).
ss: Second with two digits (00-59).
This comment was minimized by the moderator on the site
Hi, Monero Jeanniton, to format a cell with custom date format, just right-click on the cell, select Format Cells, then type the format into Type of Custom section. See screenshot:
https://www.extendoffice.com/images/stories/comments/sun-comment/format%20cells.png
This comment was minimized by the moderator on the site
Converted 123000 Lines of Data Stamp 13 Digits like a PRO Thanks alot for the tips
This comment was minimized by the moderator on the site
I have a numeric value of 3721719999 which is suppose to display as 00:06:12 (hh:mm:ss). This time represents the time duration of a video file. The date stamp on the file name is 1/18/2014 4:04 pm, if that offers any further information. I extracted the number using Filelist.exe and this was the result. Thanks!
This comment was minimized by the moderator on the site
How to convert 13 digits timestamp to human readable date ?
Could someone help please
This comment was minimized by the moderator on the site
Hi, Roobanraj, to convert 13 digits timestamp to a standard datetime, you can use the formula as this:=A1/86400000+DATE(1970,1,1), A1 is the cell that contains the 13-digits you want to convert to.
This comment was minimized by the moderator on the site
How to convert 11 digits timestamp to human readable date ?
Could someone help please
This comment was minimized by the moderator on the site
For converting 11 digits timestamp to a standard datetime, use the formula as this:=A1/864000+DATE(1970,1,1), A1 is the cell that contains the 11-digits you want to convert to.
This comment was minimized by the moderator on the site
how to convert event time stamp to hour
This comment was minimized by the moderator on the site
To convert date for MOODLE the only formula that worked was:


Instead of =(C2-DATE(1970,1,1))*86400

I tried 20/october/1980 and Moodle read 19/october/1980.

I used
=(C2-DATE(1970,1,0))*86400

I tried 20/october/1980 and Moodle read 20/october/1980.
This comment was minimized by the moderator on the site
How to convert 21 digits timestamp to human readable date ?
Could someone help please
E.g., 202002191100506253230
This comment was minimized by the moderator on the site
IF you have an LDAP 18-Digit timestamp such as 132079258679926000 the below formulas will not work. You first have to convert them as they are based in nano seconds from 1/1/1601. The following formula in Excel converts the LDAP to EPOCH to human dates =(((((A1/10000000)-11644473900)/60)/60)/24)+DATE(1970,1,1) where A1 refers to your timestamp location
This comment was minimized by the moderator on the site
Thanks for your supplement.
This comment was minimized by the moderator on the site
One thing to note is that the above is for epoch time in seconds. If you need milliseconds, you need to add a further multiplication / division by 1000. For example, converting from epoch time (milliseconds) to a date would be "=((((A1/1000)/60)/60)/24)+DATE(1970,1,1)".
This comment was minimized by the moderator on the site
Muchas gracias, para mi caso estaba adivinando porque no conocía que tipo de dato venia pero este fue la solución, el dato que me pasaron era con esta forma 1641014648299 y la formula fue esta =((((C2/1000)/60)/60)/24 )+FECHA(1970;1;1) por lo cual si alguien esta en un caso similar al mío puede optar por esta formula.

Esta formula también me sirvió pero solo trae fecha =A1/86400000+FECHA(1970;1;1)
This comment was minimized by the moderator on the site
As a side note, the best way to tell if it's seconds or milliseconds is looking at the length of the field; if it's 10 digits, it's seconds, and if it's 13 digits, it's milliseconds. "=LEN(A1)" will tell you how long the value is.
This comment was minimized by the moderator on the site
If that's too much manual work for you (or you have a list that's mixed between seconds and milliseconds), then you can use the following formula to automatically switch between seconds and milliseconds based on the length of the cell: "=((A1/86400)/IF(LEN(A1)=13,1000,1))+DATE(1970,1,1)".
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations