Topic: datetime for a search

not too dissimilar to brusulaf's question...

trying to select and display orders in a table based on this:

<%= form_tag :action => 'orders_today' %> 
Date to search: <%=   select_datetime(date = Time.now, :prefix => "order_date")  %>
<%= submit_tag "submit" %>

which when displayed in view returns this :

"month11minute01hour15day26year2006"  (called by - <%= @order_date %>)

this gets what I want in the controller: -  '2006-11-22 11:37:58.0' is the value of 'created_at' in the orders table

@orders = Order.find(:all, :conditions => ['created_at < ?', '2006-11-22 11:37:58.0'], :order => "created_at DESC")

but I want to do something like this:

@orders = Order.find(:all, :conditions => ['created_at < ?', @order_date ], :order => "created_at DESC")

Do I really need to parse and convert both the params[:order_date] and the 'created_at' in order to compare them?

Re: datetime for a search

well...I got it working this way:


controller::

 @order_date = params[:order_date]
     @month =  @order_date["month"]
    @day =  @order_date["day"]
     @year =  @order_date["year"]
     @hour =  @order_date["hour"]
      @minute =  @order_date["minute"]
     @find_order_date =  @year + "-" + @month + "-" +  @day + " " + @hour  + ":" + @minute + ".0"
     @orders = Order.find(:all, :conditions => ['created_at > ?', @find_order_date ], :order => "created_at DESC")

Where is the best place to put this kind of stuff? Is this 'helper' material?