Locale depend time output?

M

Markus Schirp

Hi All,

Is there a way to change this:

irb(main):005:0> Time.new.strftime('%A')
=> "Monday"

In this:

irb(main):005:0> Time.new.strftime('%A')
=> "Montag"

This would be the ideal implementation:

require 'locale'

Locale.locale='de_DE' do
# The new locale just exists in this block
p Time.new.strftime('%A') # => 'Montag'
end

# Now the Locale has been set back to default.
p Time.new.strftime('%A') # => 'Monday'

Does such a library exist?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,213
Messages
2,571,107
Members
47,699
Latest member
lovelybaghel

Latest Threads

Top