Convert a time span in seconds to formatted time in shell

后端 未结 7 1930
鱼传尺愫
鱼传尺愫 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 14:15

    If $i represents some date in second since the Epoch, you could display it with

      date -u -d @$i +%H:%M:%S
    

    but you seems to suppose that $i is an interval (e.g. some duration) not a date, and then I don't understand what you want.

    0 讨论(0)
提交回复
热议问题