The hh:mm:ss from seconds
t = 270921 mm, ss = t.divmod(60) #=> [4515, 21] hh, mm = mm.divmod(60) #=> [75, 15] dd, hh = hh.divmod(24) #=> [3, 3] puts "%d days, %d hours, %d minutes and %d seconds" % [dd, hh, mm, ss]