Small Date Formatting Question regarding datetime_select()


#1

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.


#2

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

Regards,
Mark


#3

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

Mark


#4

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]

?


#5

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.