Skip to content
Prev 295417 / 398503 Next

Weird date conversion

On May 23, 2012, at 11:23 , Kony-2012 wrote:

            
You really should show us some examples of dates that are incorrectly handled. 

However, a good guess is that it is a locale issue. E.g., Scandinavian languages have "maj" and "oktober" for those two months, so the three letter abbreviations are jan, feb, mar, apr, maj, jun, jul, aug, sep, okt, nov, dec. This obviously matches English locales except exactly in May and October.  The way out would seem to be to use Sys.setlocale to set LC_TIME to match the input before trying as.Date(). (Details are OS dependent, but take a look at the examples in ?Sys.setlocale.)