From: Pierre Pat Date: 2008-11-27T14:48:11+09:00 Subject: Re: To get time differnece in hours between two time values 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/.