# Date\_select

**URL:** <https://www.ruby-forum.com/t/date-select/132241>\
**Category:** Rails\
**Created:** [March 18, 2008, 7:54am UTC](https://www.ruby-forum.com/t/date-select/132241 "2008-03-18T07:54:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![subhadip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3d9bf3/32.png) [@subhadip](https://www.ruby-forum.com/u/subhadip)\
**Post date:** [March 18, 2008, 7:54am UTC](https://www.ruby-forum.com/t/date-select/132241/1 "2008-03-18T07:54:10Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![subhadip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3d9bf3/32.png) [@subhadip](https://www.ruby-forum.com/u/subhadip)\
**Post date:** [March 18, 2008, 8:26am UTC](https://www.ruby-forum.com/t/date-select/132241/2 "2008-03-18T08:26:27Z")

</div>

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-
