Convert seconds to compound duration: Difference between revisions
Convert seconds to compound duration (view source)
Revision as of 20:39, 29 December 2015
, 8 years ago→{{header|Ruby}}
(→{{header|Ruby}}: add ruby sample) |
|||
Line 975:
h, rem = rem.divmod(HOUR)
m, s = rem.divmod(MINUTE)
units = ["#{w} wk", "#{d} d", "#{h} h", "#{m} min", "#{s} sec"]
units.reject{|str| str.start_with?("0")}.join(", ")
end
|