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

Ei-ji Nakama nakama at ki.rim.or.jp
Fri Oct 8 22:53:43 CEST 2010


Hi,

> Sys.setenv(TZ="PRC")
> Sys.setlocale("LC_TIME", "Chinese")
[1] "Chinese (Simplified)_People's Republic of China.936"
> as.POSIXct("2009/03/26 01:00:00 上午" , format="%Y/%m/%d %I:%M:%S %p")
[1] "2009-03-26 01:00:00 CST"
> as.POSIXct("2009/03/26 01:00:00 下午" , format="%Y/%m/%d %I:%M:%S %p")
[1] "2009-03-26 13:00:00 CST"
>  Sys.setlocale("LC_TIME", "American")
[1] "English_United States.1252"
> as.POSIXct("2009/03/26 01:00:00 AM" , format="%Y/%m/%d %I:%M:%S %p")
[1] "2009-03-26 01:00:00 CST"
>

2010/10/8 Ted Zeng (曾振兴) <zengzhenxing �� gmail.com>:
>
> Dear All,
>
> I encounted in a problem with as.POSIXct() function.
>
>> as.POSIXct("2009/03/26 01:00:00 AM" , format="%Y/%m/%d %I:%M:%S %p")
> [1] NA
>> as.POSIXct("2009/03/26 02:00:00 PM" , format="%Y/%m/%d %I:%M:%S %p")
> [1] NA
>
> I have tried this in the R version 2.11.1,  R version 2.10.1  and R version
> 2.9.2 . They all does not work. The operation system is win7.
>
> Thanks
>
> Ted
> --
> View this message in context: http://r.789695.n4.nabble.com/Bug-in-as-POSIXct-regarding-AM-PM-tp2968076p2968076.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help �� r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>



-- 
EI-JI Nakama  <nakama (a) ki.rim.or.jp>
"\u4e2d\u9593\u6804\u6cbb"  <nakama (a) ki.rim.or.jp>



More information about the R-help mailing list