This is a discussion on How to convert number of seconds to format "17h23m24s" ? - Unix ; Let's say I have a variable $numsec which contains a number of seconds e.g. 62345 Now I want to convert this number into a more human readable form with hours, minutes and seconds e.g. 17h23m24s How can I do this ...
Let's say I have a variable $numsec which contains a number of seconds e.g. 62345
Now I want to convert this number into a more human readable form with hours,
minutes and seconds e.g.
17h23m24s
How can I do this in a shell script?
Is there really no other way but:
hour=$(($numsec/3600))
minute=$(($numsec/60-60*$hour))
sec=$(($numsec-3600*$hour-60*$minute))
echo $hour'h'$minute'h'$sec's'
I could imagine that there is a conversion function which simulates the "date" output:
echo `converttodate($numsec)` +%Hh%Mm%Ss
Matthew