1.Unix時間戳:在線獲取時間戳小工具
什么是Unix時間戳?
Unix時間戳(英文為Unix epoch, Unix time, POSIX time 或 Unix timestamp)
是從1970年1月1日(UTC/GMT的午夜)開始所經(jīng)過的秒數(shù),不考慮閏秒。
UNIX時間戳的0按照ISO 8601規(guī)范為 :1970-01-01T00:00:00Z.
一個小時表示為UNIX時間戳格式為:3600秒;一天表示為UNIX時間戳為86400秒,閏秒不計算。
在大多數(shù)的UNIX系統(tǒng)中UNIX時間戳存儲為32位,這樣會引發(fā)2038年問題或Y2038。
編程中獲取Unix時間戳(Unix timestamp):
linux時間戳獲得:[root@mail161-Centos ~]#date +%s
Java 時間戳獲得:Date date = new Date();
long time = date.getTime();
//System.currentTimeMillis()也可以獲得時間戳
//mysq 時間戳是秒只有10位,后三位是毫秒,要做處理
String dateline = time + "";
dateline = dateline.substring(0, 10);