Forum: Ruby on Rails Small Date Formatting Question regarding datetime_select()

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Df0a460118ef876e45b13b8c1a471454?d=identicon&s=25 Marston A. (marstoni)
on 2006-04-20 11:13
(Received via mailing list)
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.
3bdb0e723531e44040fe7131f723ef0b?d=identicon&s=25 Mark Paxton (mpaxton)
on 2006-04-20 14:37
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
Df0a460118ef876e45b13b8c1a471454?d=identicon&s=25 Marston A. (marstoni)
on 2006-04-20 15:20
(Received via mailing list)
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]

?
3bdb0e723531e44040fe7131f723ef0b?d=identicon&s=25 Mark Paxton (mpaxton)
on 2006-04-21 01:01
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
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-04-21 02:10
(Received via mailing list)
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 Mornini
This topic is locked and can not be replied to.