Convert a time span in seconds to formatted time in shell

后端 未结 7 1975
鱼传尺愫
鱼传尺愫 2020-12-28 13:25

I have a variable of $i which is seconds in a shell script, and I am trying to convert it to 24 HOUR HH:MM:SS. Is this possible in shell?

7条回答
  •  不思量自难忘°
    2020-12-28 13:53

    Continuing @Daren`s answer, just to be clear: If you want to use the conversion to your time zone, don't use the "u" switch, as in: date -d @$i +%T or in some cases date -d @"$i" +%T.

提交回复
热议问题