# Format Values from a date\_select

**URL:** <https://www.ruby-forum.com/t/format-values-from-a-date-select/95532>\
**Category:** Rails\
**Created:** [June 5, 2006, 4:06pm UTC](https://www.ruby-forum.com/t/format-values-from-a-date-select/95532 "2006-06-05T16:06:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssssss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8dc957/32.png) [@ssssss](https://www.ruby-forum.com/u/ssssss)\
**Post date:** [June 5, 2006, 4:06pm UTC](https://www.ruby-forum.com/t/format-values-from-a-date-select/95532/1 "2006-06-05T16:06:27Z")

</div>

Hi

I have two date select options in a form, when I try and grab these  
values using somthing like

@pMax = params[:max]

I get this in the varibale name

max(1i)2006max(2i)6max(3i)5

which has the correct data, jsut with added things like max(1i)

Whats the best way of grabbbing this data into a variable without the  
extra titles?

Scott

---

<div class="post-metadata">

**Author:** ![ssssss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8dc957/32.png) [@ssssss](https://www.ruby-forum.com/u/ssssss)\
**Post date:** [June 5, 2006, 9:45pm UTC](https://www.ruby-forum.com/t/format-values-from-a-date-select/95532/2 "2006-06-05T21:45:58Z")

</div>

ss wrote:

> Whats the best way of grabbbing this data into a variable without the  
> extra titles?

Since it appears that the date is not destined for a (DB-backed) model  
attribute of type Date, but for a plain instance variable, use  
select\_date  
instead, with its prefix option set to ‘max’. Then in your controller:

m = params[:max]  
@pMax = Date.new(m[:year], m[:month], m[:day])

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