Convert seconds to compound duration: Difference between revisions
Convert seconds to compound duration (view source)
Revision as of 22:57, 7 October 2019
, 4 years ago→{{header|Julia}}
Line 1,955:
for dm in (60, 60, 24, 7)
sec, m = divrem(sec, dm)
end
return join(["$num$unit" for (num, unit) in zip(t, ["w", "d", "h", "m", "s"]) if num > 0], ", ")
end
|