# Accessing datetime\_select value

**URL:** <https://www.ruby-forum.com/t/accessing-datetime-select-value/56832>\
**Category:** Rails\
**Created:** [April 4, 2006, 6:28pm UTC](https://www.ruby-forum.com/t/accessing-datetime-select-value/56832 "2006-04-04T18:28:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_DSGoodfello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/58956e/32.png) [@Andrew\_DSGoodfello](https://www.ruby-forum.com/u/Andrew_DSGoodfello)\
**Post date:** [April 4, 2006, 6:28pm UTC](https://www.ruby-forum.com/t/accessing-datetime-select-value/56832/1 "2006-04-04T18:28:10Z")

</div>

How do I get a value from datetime\_select? Do I need to get each value  
from it’s dropdown element individually or is there a way to get the  
date by referencing one object? Anyone have any good examples?

-Andy

---

<div class="post-metadata">

**Author:** ![Andrew\_DSGoodfello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/58956e/32.png) [@Andrew\_DSGoodfello](https://www.ruby-forum.com/u/Andrew_DSGoodfello)\
**Post date:** [April 5, 2006, 7:36am UTC](https://www.ruby-forum.com/t/accessing-datetime-select-value/56832/2 "2006-04-05T07:36:24Z")

</div>

Andrew D. Goodfellow wrote:

> How do I get a value from datetime\_select? Do I need to get each value  
> from it’s dropdown element individually or is there a way to get the  
> date by referencing one object? Anyone have any good examples?

Rails will automatically instantiate a Time attribute from the set of  
component param keys and values if you call new, update\_attribute,  
or update\_attributes with the appropriate part of the params hash.

–  
We develop, watch us RoR, in numbers too big to ignore.

---

<div class="post-metadata">

**Author:** ![Andrew\_DSGoodfello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/58956e/32.png) [@Andrew\_DSGoodfello](https://www.ruby-forum.com/u/Andrew_DSGoodfello)\
**Post date:** [October 22, 2006, 1:56am UTC](https://www.ruby-forum.com/t/accessing-datetime-select-value/56832/3 "2006-10-22T01:56:22Z")

</div>

> Rails will automatically instantiate a Time attribute from the set of  
> component param keys and values if you call new, update\_attribute,  
> or update\_attributes with the appropriate part of the params hash.

Sorry, I don’t get it. I have something like  
\<%= datetime\_select ‘bill’, ‘activity\_from’ %\>  
which generates a bunch of selectors to pick up the date and time… but  
how do I access it in the action where the form is posted to?  
@from = DateTime.new(params[:bill][:activity\_from])  
or  
@from = params[:bill][:activity\_from]  
?

Please give me a hint,

Thank you in advance!

Andreas
