Reputation: 171509
To format a Date
in English I do:
Date.today.to_s(:long_ordinal) # => September 28th, 2011
How could I format a date in Russian (or any other language) ?
Upvotes: 3
Views: 4887
Reputation: 27961
Date formats and locales are defined in ActiveSupport. You can add these values to your locale file and modify them to fit your requirements.
Also check this for russian language.
Upvotes: 1
Reputation: 15525
There is the Internationalization API in Rails that explains how to do that. See for example section 3.2 Adding Date/Time Formats.
<p><%= l Date.today, :format => :short %></p>
You can then add for your locale (russian?) a file ru.yml
and include there the definition for your format.
# config/locales/ru.yml
ru:
date:
formats:
short: "%m/%d/%Y"
See the section 4.4 Setting and Passing a Locale how to set the locale.
Upvotes: 3