4

When I enter the following code, it works fine:

bk.date1 <-  "Ma 2012 august 14 11:28:30"
bk.german.date <- ymd_hms(bk.date1, locale = "German")
bk.german.date   

# [1] "2012-08-14 11:28:30 UTC"

Unfortunately, I have not been able to find a listing or table that defines valid values for "locale".

Another valid value for locale is "English_United States.1252". Is there a website or an R command that will show all valid locale values, at least for LC_TIME? Thanks

neilfws
  • 32,751
  • 5
  • 50
  • 63
Bill Yarberry
  • 101
  • 1
  • 3
  • 2
    I didn't know either, but reading the manual is always helpful. `?ymd_hms` suggests "*locale to be used, see locales. On linux systems you can use ‘system("locale -a")’ to list all the installed locales.*" `?locales` also suggests "*The ‘R Installation and Administration’ manual for background on locales and how to find out locale names on your system.*" https://cran.r-project.org/doc/manuals/R-admin.html#Locales-under-Windows – thelatemail Mar 20 '19 at 04:20
  • 1
    Something like this ? https://stackoverflow.com/questions/20960821/what-is-a-reliable-way-of-getting-allowed-locale-names-in-r – Ronak Shah Mar 20 '19 at 04:20
  • 2
    I think you are looking for this: https://stackoverflow.com/questions/12521713/is-there-a-way-to-find-list-of-valid-locales-in-my-linux-using-perl in the R console, type `system("locale -a")` – NM_ Mar 20 '19 at 04:25
  • Someone referred me to https://learn.microsoft.com/en-us/windows/desktop/Intl/language-identifier-constants-and-strings which has a pretty comprehensive list of locales. For windows, may have to lop off the "LANG_" prefix – Bill Yarberry Mar 20 '19 at 23:06

0 Answers0