Forum: Ruby on Rails date environment.rb

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.
F87d150876b608711d5fc8154a8038c9?d=identicon&s=25 Herman Müller (gotzbold)
on 2009-05-17 20:21
Hi Ruby-Comunity!

I have a problem with date format.

To display the german date format, I put on the end of environment.rb:

ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(:default
=> '%d.%m.%Y')
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(:default
=> '%d.%m.%Y %H:%M:%S')

In index/show.html.erb datetime is displayed like expected:

05.06.2009 10:00:00

In edit.html.erb datetime is not displayed in german date format:

<%= f.text_field :valid_from %> --> displays

2009-05-05 00:00:00

Have somebody a solution?

Thanks ahead!!

Regs

Hermann
84fbb9c2a7b05c3ddf39904514585a90?d=identicon&s=25 Franco Catena (Guest)
on 2009-05-17 23:38
(Received via mailing list)
You can do this with i18n (Rails >= 2.2) setting up properly the
format in your config/locales (see examples in
http://github.com/svenfuchs/rails-i18n/tree/master...) and
then use <%= l(some_date) %>.

Regards.

Franco Catena.

On May 17, 3:21 pm, Herman Müller <rails-mailing-l...@andreas-s.net>
This topic is locked and can not be replied to.