linux下时间戳的转换

the number of seconds since the UNIX epoch

#date
-d (--date)
+%s  格式为秒

$ date -d "Aug 1 9:02" +%s
$ date -d '2022-01-01 12:00'
Sat 01 Jan 2022 12:00:00 PM CST

$ date -d '2022-01-01 12:00' +%s
1641009600

the number of seconds to a readable format

$ date -d@1234567890

#Convert seconds since the epoch (1970-01-01 UTC) to a date
$ date --date='@2147483647'

$ date -d @1641009600
Sat 01 Jan 2022 12:00:00 PM CST
posted @ 2023-03-20 09:07  mvpbang  阅读(719)  评论(0编辑  收藏  举报