r - How to convert datetime values to right timezone? -
i have datetime values like
val <- c(1376517610, 1376519412, 1376528711, 1376528411, 1376528411)
i wan't convert these values datetime , i'm trying using
> as.posixct(val, tz="eest", origin = '1970-01-01 00:00:00') [1] "2013-08-14 22:00:10 gmt" "2013-08-14 22:30:12 gmt" "2013-08-15 01:05:11 gmt" [4] "2013-08-15 01:00:11 gmt" "2013-08-15 01:00:11 gmt" warning messages: 1: in strptime(xx, f <- "%y-%m-%d %h:%m:%os", tz = tz) : unknown timezone 'eest' 2: in as.posixct.posixlt(x) : unknown timezone 'eest' 3: in strptime(x, f, tz = tz) : unknown timezone 'eest' 4: in as.posixct.posixlt(as.posixlt(x, tz, ...), tz, ...) : unknown timezone 'eest' 5: in as.posixlt.posixct(x, tz) : unknown timezone 'eest'
but timezone eest
> sys.timezone() [1] "eest"
how solve problem , convert data right timezone?
as case this question, shouldn't specify daylight saving time timezone, use normal timezone, system understand summer time because of date:
as.posixct(val, tz="eet", origin = '1970-01-01 00:00:00') [1] "2013-08-14 23:00:10 eest" "2013-08-14 23:30:12 eest" "2013-08-15 02:05:11 eest" "2013-08-15 02:00:11 eest" "2013-08-15 02:00:11 eest"
nb: posted answer because think resolves "unknown timezone" issue. there indeed still issue appears utc +1 when should utc +3. using "europe/helsinki" gives same error (at least me on mac os x 10.6 , r 2.14.2, french locale):
as.posixct(val, tz="europe/helsinki", origin = '1970-01-01 00:00:00') [1] "2013-08-14 23:00:10 eest" "2013-08-14 23:30:12 eest" "2013-08-15 02:05:11 eest" "2013-08-15 02:00:11 eest" "2013-08-15 02:00:11 eest"
Comments
Post a Comment