I have a data frame named df like that
id time
1 1392825600
2 1392825597
3 1392825587
where is time the time in seconds since epoch at UTC (the local time of the data is the Hong Kong timezone)
I would like to put this into a standard time stamp using POSIXct
For example
> test = as.POSIXct(1392825587, origin="1970-01-01", tz = "Hongkong")
> test
[1] "2014-02-19 23:59:47 HKT"
But when I want to apply that to my data frame, here is what i get:
df$TimeStamp = as.POSIXct(df$time, origin="1970-01-01", tz = "Hongkong")
id time TimeStamp
1 1392825600 2014-02-19 23:00:00
2 1392825597 2014-02-19 22:59:57
3 1392825587 2014-02-19 22:59:47
Everything have a lag of 1hour and it looks like the time zone used was my computer's one rather than the HK one (my time zone as 1 hour difference with HK)