/ Published in: Rails
URL: http://www.perplexedlabs.com/2008/02/08/seconds-to-minutesseconds-in-rails/
convertsecondsto_time(630) =>"10m 30s"
Expand |
Embed | Plain Text
def convert_seconds_to_time(seconds) total_minutes = seconds / 1.minutes seconds_in_last_minute = seconds - total_minutes.minutes.seconds "#{total_minutes}m #{seconds_in_last_minute}s" end
You need to login to post a comment.
