Seconds to HH:MM in Ruby
def seconds_to_hh_mm(seconds)
hours = seconds / 3600
minutes = (seconds % 3600) / 60
"%02d:%02d" % [hours, minutes]
end
# Example usage:
total_seconds = 3665
formatted_time = seconds_to_hh_mm(total_seconds)
puts formatted_time