Below is a little shell function (whose principle I've found on the web, because I'm lazy – and that I decided to publish here to easily find it again) to naively convert a number of seconds to hours, minutes and seconds (the calculation of a number of days can be trivially added if needed):
Note that this function is POSIX-compatible and could therefore be used in any command-line interpreter that implements this standard.
Here is en example of its usage:
$ seconds2human 12345
3h 25m 45s
Just for the sake of verification, let's test it on a easily recognizable
number (24 h × 60 min × 60 sec = 86400 sec
) :
$ seconds2human 86461
24h 01m 01s