# Small Date Formatting Question regarding datetime\_select()

**URL:** <https://www.ruby-forum.com/t/small-date-formatting-question-regarding-datetime-select/58296>\
**Category:** Rails\
**Created:** [April 20, 2006, 11:13am UTC](https://www.ruby-forum.com/t/small-date-formatting-question-regarding-datetime-select/58296 "2006-04-20T11:13:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marstoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9bcb4/32.png) [@marstoni](https://www.ruby-forum.com/u/marstoni)\
**Post date:** [April 20, 2006, 11:13am UTC](https://www.ruby-forum.com/t/small-date-formatting-question-regarding-datetime-select/58296/1 "2006-04-20T11:13:07Z")

</div>

Is there a way to make datetime\_select() dropdowns work on a 12hr  
clock? I need to make a input field that works exactly like the  
reminders datetime selecton dropdowns in Backpack to populate a  
datetime field in my DB. i.e in the format: month, day, year ? hour  
(1-12) minute am/pm. Should I change my database to have a separate  
column for date and one for time and use date\_select()?

Can I do that with datetime\_select or will I have to create a special  
helper method and what would that code look like? Thanks for any  
info in advance.

---

<div class="post-metadata">

**Author:** ![marstoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9bcb4/32.png) [@marstoni](https://www.ruby-forum.com/u/marstoni)\
**Post date:** [April 20, 2006, 2:37pm UTC](https://www.ruby-forum.com/t/small-date-formatting-question-regarding-datetime-select/58296/2 "2006-04-20T14:37:10Z")

</div>

Marston A. wrote:

> Is there a way to make datetime\_select() dropdowns work on a 12hr  
> clock?

Hello,

Check out the following plugin:

[http://wiki.rubyonrails.org/rails/pages/12-Hour+Time+Plugin](http://wiki.rubyonrails.org/rails/pages/12-Hour+Time+Plugin)

Regards,  
Mark

---

<div class="post-metadata">

**Author:** ![marstoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9bcb4/32.png) [@marstoni](https://www.ruby-forum.com/u/marstoni)\
**Post date:** [April 21, 2006, 1:01am UTC](https://www.ruby-forum.com/t/small-date-formatting-question-regarding-datetime-select/58296/3 "2006-04-21T01:01:53Z")

</div>

Marston A. wrote:

> Mark,
> 
> Excellent, thanks I will definitely check this out.
> 
> Would you happen to know how to change the default date format in  
> datetime\_select() (also identical to how its shown in the reminders  
> section of backpack). I.e have dropdowns like:
> 
> [April] [20] [2006]
> 
> instead of the default
> 
> [2006] [April] [20]
> 
> ?

Not sure, I think there may be a different plugin that does both:  
[http://wiki.rubyonrails.org/rails/pages/FlexTimes+Plugin](http://wiki.rubyonrails.org/rails/pages/FlexTimes+Plugin)

Mark

---

<div class="post-metadata">

**Author:** ![marstoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9bcb4/32.png) [@marstoni](https://www.ruby-forum.com/u/marstoni)\
**Post date:** [April 20, 2006, 3:20pm UTC](https://www.ruby-forum.com/t/small-date-formatting-question-regarding-datetime-select/58296/4 "2006-04-20T15:20:42Z")

</div>

Mark,

Excellent, thanks I will definitely check this out.

Would you happen to know how to change the default date format in  
datetime\_select() (also identical to how its shown in the reminders  
section of backpack). I.e have dropdowns like:

[April] [20] [2006]

instead of the default

[2006] [April] [20]

?

---

<div class="post-metadata">

**Author:** ![marstoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9bcb4/32.png) [@marstoni](https://www.ruby-forum.com/u/marstoni)\
**Post date:** [April 21, 2006, 2:10am UTC](https://www.ruby-forum.com/t/small-date-formatting-question-regarding-datetime-select/58296/5 "2006-04-21T02:10:25Z")

</div>

Here’s a snippet from one of my projects:

\<%= date\_select ‘user’,  
‘born\_on’,  
:start\_year =\> Time.now.years\_ago(100).year,  
:end\_year =\> Time.now.years\_ago(18).year,  
:order =\> [:month,:day,:year] %\>

–  
– Tom M.
