跳到主要內容

如何在Excel中的日期和Unix時間戳之間轉換?

Unix時間戳也稱為時代時間或POSIX時間,在許多操作系統或文件格式中廣泛使用。 本教程討論的是Excel中日期和Unix時間戳之間的轉換。

將日期轉換為時間戳

將日期和時間轉換為時間戳

將時間戳轉換為日期

有關日期時間轉換的更多教程...


箭頭藍色右氣泡 將日期轉換為時間戳

要將日期轉換為時間戳,可以使用公式來計算。

選擇一個空白單元格,假設單元格C2,然後鍵入此公式 =(C2-DATE(1970,1,1))* 86400 進入並按 Enter 鍵,如果需要,您可以通過拖動自動填充手柄來應用此公式的範圍。 現在,一系列日期單元已轉換為Unix時間戳。
文檔轉換日期-unix-1


2 單擊將時間轉換為十進制小時、分鐘或秒

轉換時間 的特點 Excel的Kutools 可以幫助您快速將時間轉換為十進制的小時、分鐘或秒,並將結果放置在原始目的地或另一個目的地。

文檔轉換時間 1

箭頭藍色右氣泡 將日期和時間轉換為時間戳

有一個公式可以幫助您將日期和時間轉換為Unix時間戳。

1.首先,您需要在1/1/1970單元格中輸入協調世界時。 看截圖:
文檔轉換日期-unix-2

2.然後鍵入此公式 =(A1- $ C $ 1)* 86400 進入細胞,按 Enter 鍵,然後根據需要將自動填充手柄拖到帶有此公式的範圍內。 看截圖:
文檔轉換日期-unix-3

保養竅門:在公式中,A1是日期和時間單元格,C1是您輸入的通用坐標時間。


箭頭藍色右氣泡 將時間戳轉換為日期

如果您有轉換為日期所需的時間戳列表,則可以執行以下步驟:

1.在時間戳列表旁邊的空白單元格中,鍵入以下公式 =(((A1/60)/60)/24)+DATE(1970,1,1), 按 Enter 鍵,然後將自動填充手柄拖到所需的範圍。
文檔轉換日期-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選項卡為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