[shell seconds change to time]
i=1493277357
date -d @$i +"%F_%T"
date -d @1493277357 +"%F_%T"
https://stackoverflow.com/questions/13422743/convert-a-time-span-in-seconds-to-formatted-time-in-shell
The @${i} part is how you tell date that $i is in seconds
man date
-d, --date=STRING
display time described by STRING, not 'now'
EXAMPLES
Convert seconds since the epoch (1970-01-01 UTC) to a date
$ date --date='@2147483647'
Show the time on the west coast of the US (use tzselect(1) to find TZ)
$ TZ='America/Los_Angeles' date
Show the local time for 9AM next Friday on the west coast of the US
$ date --date='TZ="America/Los_Angeles" 09:00 next Fri'
i=1493277357
date -d @$i +"%F_%T"
date -d @1493277357 +"%F_%T"
https://stackoverflow.com/questions/13422743/convert-a-time-span-in-seconds-to-formatted-time-in-shell
The @${i} part is how you tell date that $i is in seconds
man date
-d, --date=STRING
display time described by STRING, not 'now'
EXAMPLES
Convert seconds since the epoch (1970-01-01 UTC) to a date
$ date --date='@2147483647'
Show the time on the west coast of the US (use tzselect(1) to find TZ)
$ TZ='America/Los_Angeles' date
Show the local time for 9AM next Friday on the west coast of the US
$ date --date='TZ="America/Los_Angeles" 09:00 next Fri'
没有评论:
发表评论