Sunday, May 16, 2010

[Rails] Time problems

I am storying a column called start time and endtime, both having
mysql type "time".

I am using formtastic to create the forms like

<%= f.input :time_start, :label => "Between", :as
=> :time, :ignore_date => true %>

The time gets stored just fine (though in 24 hour format, which is
another headache), but when I extract this time to compare it to
Time.now, to figure out, if "now" is between end and start time, the
time returned is something like Sat Jan 01 15:00:00 UTC 2000, which is
nowhere in 2010.

Why is this happening? Whats the best way to store start and end time
to compare later on with "now".

Thanks

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate