Date madness

I have a column called ‘time_in’ and it is actually a timestamp so it
has a date and a time.

I created a method in my model called time_in_date which is simply
time_in.strftime("%m/%d/%Y")

I can’t do an sql find on a column that doesn’t exist so how do I find
for a specific date?

Craig

If you’re using mysql have a look at its date functions:

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

Model.find(:all, :conditions => [‘DATE(time_in) = ?’, Date.today]) may
be what you want.

-Jonathan.

Postgres but I’ll start with that tomorrow…

Thanks

Craig

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs