can anyone tell me why R give such outcome below:
> as.POSIXct(\"2013-01-01 08:00\") [1] \"2013-01-01 08:00:00 HKT\" > as.Date(as.POSIXct(\"2013-01-01
The problem here is timezones - you can see you're in "HKT". Try:
"HKT"
as.Date(as.POSIXct("2013-01-01 07:00", 'GMT')) [1] "2013-01-01"
From ?as.Date():
?as.Date()
["POSIXct" is] converted to days by ignoring the time after midnight in the representation of the time in specified timezone, default UTC
POSIXct