do it like this---
In view---
date_select(:from, :date, options)
in controller ---
remember when you give date_select it creates a hash like this---
"from" => { "date(1i)" => "value",
"date(2i)" => "value", "date(3i)"
=> "value" }
from_date =
(params["from"]["date(1i)"].to_s+"-"+params["from"]
["date(2i)"].to_s+"-"+params["from"]["date(3i)"].to_s).to_date
this will give you the format you desire.---->>>>>
also when i write query
@infos=Info.find(:all,:conditions => ["dt > ?", params[:form]])
it didn''t compare..so what is the reason behind this..
>>>>
use from_date in find command instead of params[:form]
I think this should do.
On Mar 18, 11:54 am, Subhadip Chakraborty <rails-mailing-l...@andreas-
s.net> wrote:> i have one date_select tag.the code is:
> <%=date_select(:from, '''', :start_year => 1950,
:include_blank => true)%>
> in controller i wrote::
> @result =params[:from]
> which show date:
> (3i)4(1i)1969(2i)8
> but i want to show it in form 1969-08-04(yyyy-mm-dd)format.
> for this reason i wrote:
> @result =params[:from].to_s(:db)
> but this also not work..please
> mention write code so that i view in 1969-08-04(yyyy-mm-dd)format.
> also when i write query
> @infos=Info.find(:all,:conditions => ["dt > ?",
params[:form]])
> it didn''t compare..so what is the reason behind this..
> please help..............very urgent..
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---