I have a customer that has a request that the select_datetime fields have AM/PM selectors instead of 24 hour time. The rails time and datetime selects seem to only support 24 hour time. I can''t seem to find any information on this. i was wondering if there is already a solution out there, or will i have to roll my own? Sean Wolfe master nerd of i heart squares, inc. 3711 N. Ravenswood Ave. #147 Chicago, IL 60613 http://www.iheartsquares.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060608/4aa674e0/attachment-0001.html
Sean Wolfe wrote:> I have a customer that has a request that the select_datetime fields > have AM/PM selectors instead of 24 hour time. > The rails time and datetime selects seem to only support 24 hour time. > I can''t seem to find any information on this. i was wondering if > there is already a solution out there, or will i have to roll my own? > > Sean Wolfe > master nerd of > i heart squares, inc. > > 3711 N. Ravenswood Ave. #147 Chicago, IL 60613 > http://www.iheartsquares.comthere is already solution out there.. and dont need much coding also... cos this is only a formatting question.... using the strftime method would solve the trick! options to use are just like the usual sql commands... eg. my_date.strftime("%Y-%m-%d--%H:%M") will generate 2006-06-09--17:30 my_date.strftime("%Y-%m-%d--%I:%M%p") will generate 2006-06-09--5:30PM hope this helps! -- Posted via http://www.ruby-forum.com/.
that''s all fine if it''s just the var my_date you''re trying to format, but how would you go about modifying the datetime_select tag? <%= datetime_select ''bug'', ''added_at'' %> I can''t get it to work with .strftime in there.. -- Posted via http://www.ruby-forum.com/.
On 6/8/06, Sean Wolfe <sean@iheartsquares.com> wrote:> I have a customer that has a request that the select_datetime fields have > AM/PM selectors instead of 24 hour time.Here''s a solution I whipped up for a project a while back. Might not be the best solution, but it did the trick. http://www.atlrug.org/atlrug/show/12HourHelper -eric
Eric Wagoner wrote:> On 6/8/06, Sean Wolfe <sean@iheartsquares.com> wrote: >> I have a customer that has a request that the select_datetime fields have >> AM/PM selectors instead of 24 hour time. > > Here''s a solution I whipped up for a project a while back. Might not > be the best solution, but it did the trick. > > http://www.atlrug.org/atlrug/show/12HourHelperAhhh! Fantastic. And this is a lot better than i was expecting. Nice solution to put it all into a single Drop. I thought about it being a mess to have AM/PM selector on the side. I''ve posted this link into my del.icio.us -- Posted via http://www.ruby-forum.com/.
I also made something similar, with an am/pm dropdown and model support: http://www.happyfreelancer.com/?p=10 This is also supposed to be very good: http://wiki.rubyonrails.org/rails/pages/FlexTimes+Plugin Hope this helps! -----Original Message----- From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Sean Wolfe Sent: Thursday, June 08, 2006 10:36 AM To: rails@lists.rubyonrails.org Subject: [Rails] Re: AM/PM select Eric Wagoner wrote:> On 6/8/06, Sean Wolfe <sean@iheartsquares.com> wrote: >> I have a customer that has a request that the select_datetime fields have >> AM/PM selectors instead of 24 hour time. > > Here''s a solution I whipped up for a project a while back. Might not > be the best solution, but it did the trick. > > http://www.atlrug.org/atlrug/show/12HourHelperAhhh! Fantastic. And this is a lot better than i was expecting. Nice solution to put it all into a single Drop. I thought about it being a mess to have AM/PM selector on the side. I''ve posted this link into my del.icio.us -- Posted via http://www.ruby-forum.com/. _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails