From: "Florian Aßmann" Date: 2008-11-27T15:57:37+09:00 Subject: Re: To get time differnece in hours between two time values (Time.now - incidents.first.created_on) / 1.hour Am 27.11.2008 um 06:48 schrieb Pierre Pat: > Sijo Kg wrote: >> Hi >> I have two values like incidents.first.created_on and Time.now >> bothe are of class Time Now I would like to get differnet between >> these >> two in hours I gtried like >> >> (Time.now-incidents.first.created_on).hours >> But getting wrong result..Could you please tell how I can do >> this? >> >> Thanks in advance >> Sijo > > Time.now-incidents.first.created_on will return you the number of > seconds in Numeric, that's why you can't call the method 'hours' on > it. > I haven't seen a method which would convert seconds in hours for > you, if > there really isn't one, you'll have to make the convertion to hours > yourself... > > Cheers. > -- > Posted via http://www.ruby-forum.com/. >