[R] Bug in as.POSIXct regarding AM/PM

Ted Zeng (曾振兴) zengzhenxing at gmail.com
Sat Oct 9 05:07:25 CEST 2010


My locale information is as follows:
> sessionInfo()
R version 2.11.1 (2010-05-31) 
i386-pc-mingw32 

locale:
[1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936 
[2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936   
[3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
[4] LC_NUMERIC=C                                                   
[5] LC_TIME=Chinese (Simplified)_People's Republic of China.936    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] JGR_1.7-2    iplots_1.1-3 JavaGD_0.5-3 rJava_0.8-5 

loaded via a namespace (and not attached):
[1] tools_2.11.1



However, as Gabor said, If I set the locale time to "English". It works.

> Sys.setlocale("LC_TIME", "English")
[1] "English_United States.1252"
> Sys.getlocale("LC_TIME")
[1] "English_United States.1252"
> as.POSIXct("2009/03/26 01:00:00 PM" , format="%Y/%m/%d %I:%M:%S %p")
[1] "2009-03-26 13:00:00 CST"


SO, What is the Problem? How to solve this problem.


-- 
View this message in context: http://r.789695.n4.nabble.com/Bug-in-as-POSIXct-regarding-AM-PM-tp2968076p2969281.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list