From: Rick DeNatale Date: 2009-11-18T13:25:25+09:00 Subject: Re: How to time something? On Tue, Nov 17, 2009 at 10:53 PM, Brian Geds wrote: > Heres what I have right now but it does reset the sec. to zero  it keeps > going 61..62 > > def seconds_minutes_string(seconds_elapsed) >  seconds = seconds_elapsed % 59 >  minutes = seconds / 60 >  return minutes.to_s + ':' + seconds.to_s > end I'm not sure what you mean that "it doesn't reset the sec to zero def seconds_minutes_string(seconds_elapsed) seconds = seconds_elapsed % 59 minutes = seconds / 60 return minutes.to_s + ':' + seconds.to_s end (55..65).map {|secs| seconds_minutes_string(secs)} # => ["0:55", "0:56", "0:57", "0:58", "0:0", "0:1", "0:2", "0:3", "0:4", "0:5", "0:6"] This should produce the right strings, I assume you wanted 1:01 instead of 1:1 for 1 minute and 1 second def seconds_minutes_string(seconds_elapsed) "%d:%02d" % [seconds_elapsed / 60, seconds_elapsed % 60] end (55..65).map {|secs| seconds_minutes_string(secs)} # => ["0:55", "0:56", "0:57", "0:58", "0:59", "1:00", "1:01", "1:02", "1:03", "1:04", "1:05"] -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale