How can I convert seconds to hours, minutes and seconds?
show_time() { ????? } show_time 36 # 00:00:36 show_time 1036 # 00:17:26 show_time 91925 # 25:32:0
I couldn't get Vaulter's/chepner's code to work correctly. I think that the correct code is:
convertsecs() { h=$(($1/3600)) m=$((($1/60)%60)) s=$(($1%60)) printf "02d:%02d:%02d\n $h $m $s }