Seconds to HH:MM:SS Format an integer number of seconds as a zero-padded HH:MM:SS clock string, including hours beyond 24 when the duration is long. Language: Ruby Added on: 18th August 2026 Submitted by: Lupraxus def seconds_to_hms(sec) [sec / 3600, sec / 60 % 60, sec % 60].map { |t| t.to_s.rjust(2, '0') }.join(':') end