I searched if somebody else has done a similar work, I found Date/Time convert to String (e.g. Seconds > 1:09:15.123) but since the format of output is different, I think I can go on.
/* // Take a number of seconds, and format it in a readable // way, like 11 days 14 hours 3 minutes 21 seconds. // If a number is zero, skip it: 2 hours 3 seconds. // Put correct plural: 1 hour 1 minute. */ GetFormatedTime(_seconds) { local d, h, m, s, t d := _seconds // 86400 _seconds -= d * 86400 h := _seconds // 3600 _seconds -= h * 3600 m := _seconds // 60 s := _seconds - m * 60 If (d > 1) t := d . " days" Else If (d = 1) t := "1 day" If (t != "" and h + m + s > 0) t := t . " " If (h > 1) t := t . h . " hours" Else If (h = 1) t := t . "1 hour" If (t != "" and m + s > 0) t := t . " " If (m > 1) t := t . m . " minutes" Else If (m = 1) t := t . "1 minute" If (t != "" and s > 0) t := t . " " If (s > 1) t := t . s . " seconds" Else If (s = 1) t := t . "1 second" Else If (t = "") t := "0 seconds" Return t }
Test: MsgBox % ( Join GetFormatedTime(11001001) . "`n" . GetFormatedTime(1001001) . "`n" . GetFormatedTime(101001) . "`n" . GetFormatedTime(11001) . "`n" . GetFormatedTime(3661) . "`n" . GetFormatedTime(1001) . "`n" . GetFormatedTime(100) . "`n" . GetFormatedTime(10) . "`n" . GetFormatedTime(1) . "`n" . GetFormatedTime(0) . "`n" . "" )