Both the following two lines of code return NA.
as.POSIXct("1-March-2021 11:45", format="%d-%B-%Y %H:%M")
as.POSIXct("1-Mar-2021 11:45", format="%d-%b-%Y %H:%M")
But if I change March
to 3
, it works fine.
as.POSIXct("1-3-2021 11:45", format="%d-%m-%Y %H:%M")
I am stuck here. Thanks for any hint.
What's your OS? This works here (on Ubuntu)
> as.POSIXct("1-March-2021 11:45", format="%d-%B-%Y %H:%M")
[1] "2021-03-01 11:45:00 CST"
> as.POSIXct("1-Mar-2021 11:45", format="%d-%b-%Y %H:%M")
[1] "2021-03-01 11:45:00 CST"
>
Localization may matter too. I am in a US-English one:
> Sys.getenv("LANG")
[1] "en_US.UTF-8"
>