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?
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...
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...
almost implies that it uses a framework like Rails so I naively blown these nn chars into this e-mail.
Cheers
Florian
···
Am 27.11.2008 um 12:03 schrieb Robert Dober:
On Thu, Nov 27, 2008 at 7:57 AM, Florian Aßmann > <florian.assmann@email.de> wrote:
(Time.now - incidents.first.created_on) / 1.hour
I do not think that 1 responds to that message.
but using 3600 instead should do the trick.
HTH
Robert
--
Ne baisse jamais la tête, tu ne verrais plus les étoiles.