茫茫網海中的冷日
         
茫茫網海中的冷日
發生過的事,不可能遺忘,只是想不起來而已!
 恭喜您是本站第 1669134 位訪客!  登入  | 註冊
主選單

Google 自訂搜尋

Goole 廣告

隨機相片
IMG_60D_00240.jpg

授權條款

使用者登入
使用者名稱:

密碼:


忘了密碼?

現在就註冊!

微軟帝國 : [轉貼]在 Excel 裡轉換 Unixtime 格式

發表者 討論內容
冷日
(冷日)
Webmaster
  • 註冊日: 2008/2/19
  • 來自:
  • 發表數: 15771
[轉貼]在 Excel 裡轉換 Unixtime 格式

在 Excel 裡轉換 Unixtime 格式

腦子不好了,每次都記不起來,還是寫一下。

先說文解字一番

《何謂 Unix 時間》From: 維基百科
UNIX時間,或稱POSIX時間是UNIX或類UNIX系統使用的時間表示方式:從協調世界時(UTC)1970年1月1日0時0分0秒起至現在的總秒數,不包括閏秒。

《Excel 的 時間計算》From: 微軟技術支援
Excel 會將所有日期儲存為整數,並將所有時間儲存為小數。有了這個系統,Excel 可以將日期與時間當做數字般地進行加減或比較,並且透過此系統變更所有日期。

在此系統中,序號 1 代表 1/1/1900 12:00:00 a.m。時間是以 .0 到 .99999 的小數而儲存,其中 .0 表示 00:00:00,而 .99999 表示 23:59:59。日期整數與時間小數可以結合為含有小數與整數部份的數字。例如,數字 32331.06 代表日期與時間 7/7/1988 1:26:24 a.m。


很囉嗦厚~直接記公式吧~

Excel 底下的轉換公式:=Unixtime / 86400 + 25569

解釋:86400 是一天的秒數,25569 是從 1900年1月1日 至 1970年1月1日 的天數,記得嗎?Excel是從1900年1月1日起算的!

後記:
這個公式算出來的會是UTC國際標準時的時間,所以如果要計算出台灣的時間(GMT+08:00),公式則為:=Unixtime / 86400 + 25569 + 8/24 ,也就是要再加 8 小時的意思啦!

看圖說故事:

1.輸入公式


2.修改欄位為日期格式





3.搞定

原文出處:在 Excel 裡轉換 Unixtime 格式
冷日
(冷日)
Webmaster
  • 註冊日: 2008/2/19
  • 來自:
  • 發表數: 15771
[轉貼]How to convert between date and Unix timestamp in Excel?

How to convert between date and Unix timestamp in Excel?

Unix timestamp is also called Epoch time or POSIX time which is wildly used in many operating systems or file formats. This tutorial is talking about the conversion between date and Unix timestamp in Excel.

Select a blank cell and type this formula =(A1-DATE(1970,1,1))*86400 into it and press Enter key, if you need, you can apply a range with this formula by dragging the autofill handle. Now a range of date cells have been converted to Unix timestamps.



Convert date and time to timestamp

There is a formula that can help you convert date and time to Unix timestamp.

1. Firstly, you need to type the Coordinated Universal Time into a cell, 1/1/1970. See screenshot:

2. Then type this formula =(A1-$C$1)*86400 into a cell, press Enter key, then if you need, drag the autofill handle to a range with this formula. See screenshot:


Tips: In the formula, A1 is the date and time cell, C1 is the coordinate universal time you typed.


Convert timestamp to date

If you have a list of timestamp needed to convert to date, you can do as below steps:

Never need to worry about long long formulas in Excel anymore! Kutools for Excel's Auto Text can add all formulas to a group
as auto text, and liberate your brain!
Click here to know Auto Text      Click here to get free trial

1. In a blank cell next to your timestamp list and type this formula =(((A1/60)/60)/24)+DATE(1970,1,1), press Enter key, then drag the auto fill handle to a range you need.


2. Then right click the cells used the formula, and select Format Cells from the context menu, then in the popping Format Cells dialog, under Number tab, click Date in the Category list, then select the date type in the right section.

3. Click OK, now you can see the Unix timestamps have been converted to dates.

Tips:

1. A1 indicates the timestamp cell you need.

2. This formula also can use to convert timestamp series to date and time, just format the result to the date and time format.


原文出處:
How to convert between date and Unix timestamp in Excel?

冷日:
簡單來說,Unix Time 本來就是從 1970 年的一月一日開始到現在的秒數,所以先把

 DATE(1970,1,1)
當作基底就可以了!
但是還有一種特殊狀況,就是『 以 ms 為單位的 Unix Time』!
那也很簡單阿,就是把那 1000 也除掉阿!!!
也就是「=(((A1/60)/60)/24/1000)+DATE(1970,1,1)」

前一個主題 | 下一個主題 | 頁首 | | |



Powered by XOOPS 2.0 © 2001-2008 The XOOPS Project|