When formatting dates, months are displayed in Russian and alphabetical order

I have a problem that when I do formatting:

format(as.Date('2019-04-09', '%Y-%m-%d'), '%B')

I receive this:
[1] "апрель"

How can I change language for Date?
I’d really appreciate your help

I think you need to change the LC_TIME component of you locale. You can see how the locale is set with Sys.getlocale(). I use Windows 10 in the United States and I get the following. Notice LC_TIME=English_United States.utf8 at the end of the output.

[1] "LC_COLLATE=English_United States.utf8;LC_CTYPE=English_United States.utf8;LC_MONETARY=English_United States.utf8;LC_NUMERIC=C;LC_TIME=English_United States.utf8"

What you should set LC_TIME to depends on your operating system. You can try

Sys.setlocale(category = "LC_TIME", "English")

Thank you for your response. Tell me please, if I have geolocation in Ukraine, will it work?

Sorry, I'm not sure what you mean. In what language do you want the result to be? What is your operating system? What is the result of


[1] "LC_COLLATE=Russian_Ukraine.utf8;LC_CTYPE=Russian_Ukraine.utf8;LC_MONETARY=Russian_Ukraine.utf8;LC_NUMERIC=C;LC_TIME=Russian_Ukraine.utf8"

What about my two other questions?

I want that Date would be in English.
OS: Microsoft Windows 11 Pro

Yes, I think running

Sys.setlocale(category = "LC_TIME", "English")

will work for you. It solved a similar problem in this thread:

That user had LC_TIME=Spanish_Spain.utf8 but I doubt that difference matters.

Thank you for your attention and help ))

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.