Rob Biedenharn wrote:
> If you want to clean up your own method:
> 
> days, dayfrac = diff.divmod(1.day)
> hours, hrfrac = dayfrac.divmod(1.hour)
> mins, secs = hrfrac.divmod(1.min)
> 
> if days >= 7
>    return "more than 7 days"
> else
>    result = []
>    result << "%sgg,"%days unless days.zero?
>    result << "%d:%0d"%[hours,mins]
>    return result.join(' ')
> end
> 
> -Rob
> 
> Rob Biedenharn    http://agileconsultingllc.com
> Rob / AgileConsultingLLC.com

Thanks Rob, I knew about distance_of_time_in_words but I want my own 
method.
Cool the divmod..
-- 
Posted via http://www.ruby-forum.com/.