如何在linux下进行date/time相关的转换?

1.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

2.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