# The usage of datetime\_select

**URL:** <https://www.ruby-forum.com/t/the-usage-of-datetime-select/156025>\
**Category:** Rails\
**Created:** [December 19, 2008, 12:37pm UTC](https://www.ruby-forum.com/t/the-usage-of-datetime-select/156025 "2008-12-19T12:37:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![on9west](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/6f9a4e/32.png) [@on9west](https://www.ruby-forum.com/u/on9west)\
**Post date:** [December 19, 2008, 12:37pm UTC](https://www.ruby-forum.com/t/the-usage-of-datetime-select/156025/1 "2008-12-19T12:37:20Z")

</div>

Dear all

I am a rails beginner, I would like to know how can I manipulate the  
params in controller, when the datetime\_select is used in form. Please  
give me some advices. Thank you very much.

view/test/index.html.erb  
\<% form\_tag :action =\> “search” do %\>  
\<%= datetime\_select(“from”, “range”, :start\_year =\> 2007) %\>  
\<%= submit\_tag “search” %\>  
\<% end %\>

controllers/test.rb  
def search  
selected\_date = How to do it here??  
@records = Record.find(:all, :conditions =\> “created\_at \>  
#{selected\_date}”)  
render :action =\> ‘index’  
end

Many thanks  
Valentino

---

<div class="post-metadata">

**Author:** ![on9west](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/6f9a4e/32.png) [@on9west](https://www.ruby-forum.com/u/on9west)\
**Post date:** [December 19, 2008, 1:18pm UTC](https://www.ruby-forum.com/t/the-usage-of-datetime-select/156025/2 "2008-12-19T13:18:25Z")

</div>

> [Dates, params and you - Space Vatican](http://www.spacevatican.org/2008/12/3/dates-params-and-you)
> 
> Fred

Thank for information, it work for me. But it seems that the date time  
control is not fancy in rails.

---

<div class="post-metadata">

**Author:** ![on9west](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/6f9a4e/32.png) [@on9west](https://www.ruby-forum.com/u/on9west)\
**Post date:** [December 19, 2008, 12:42pm UTC](https://www.ruby-forum.com/t/the-usage-of-datetime-select/156025/3 "2008-12-19T12:42:46Z")

</div>

On 19 Dec 2008, at 11:37, Valentino L. wrote:

> Dear all
> 
> I am a rails beginner, I would like to know how can I manipulate the  
> params in controller, when the datetime\_select is used in form. Please  
> give me some advices. Thank you very much.

> **[Dates, params and you - Space Vatican](https://www.spacevatican.org/2008/12/3/dates-params-and-you/)**
>
> A not particularly nice area of Rails are the date and time helpers. 3 popups just isn’t a very nice bit of user interface. It’s a lot of …

Fred
