Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add seconds (in fixnum format) to a datetime, Rails

I need to pass a variable to my view with Time.now + @seconds in time format (i.e. 12pm + 3600 seconds = 1:00pm, which goes to the view).

Time.now + @seconds #seconds is a fixnum

doesn't work because "Time can't be coerced into Fixnum". How then can I generate this simple result?

like image 428
sscirrus Avatar asked Sep 30 '10 01:09

sscirrus


1 Answers

Don't barbeque me if this is wrong now but back when I was doing Rails you would just say Time.now + @seconds.seconds . Also @seconds.seconds.from_now

like image 159
Chuck Vose Avatar answered Sep 25 '22 01:09

Chuck Vose