epoch(unix timestamp) convert in linux

在 linux 計算時間, 通常的作法都是先把時間轉換成 epoch aka unix timestamp(從1970年1月1日0時0分0秒到目前時間的秒數), 再來做計算, 下方為 epoch 的轉換方式.
### Convert from human readable date to epoch
date +%s -d "Jan 1, 1980 00:00:01"
### Convert from epoch to human readable date
date -d @1190000000
ref: this.

0 comments:

張貼留言