[R] Time OffSet From GMT - Losing it

rivercode aquanyc at gmail.com
Fri Oct 8 21:43:45 CEST 2010


Losing time offset from GMT:

> sTime = as.POSIXct(paste("2008-03-03","09:30:01"), origin="1970-01-01")
> sTime
[1] "2008-03-03 09:30:01 EST"  <---- 9.31am EST

> sTime
[1] 1204554601

> t = as.numeric(sTime)


> as.POSIXct(t, origin="1970-01-01")
[1] "2008-03-03 14:30:01 EST"  <----- no tz option and t is sTime + 5 hours
ahead (assume because  I am in EST)

> as.numeric(as.POSIXct(t, origin="1970-01-01"))
[1] 1204572601  <-----  value of t is sTime +5 hours 

> as.POSIXct(t, origin="1970-01-01", tz="GMT")
[1] "2008-03-03 14:30:01 GMT"   <--- time has not changed even though I used
tz=”GMT”

> as.numeric(as.POSIXct(t, origin="1970-01-01", tz="GMT"))
[1] 1204554601 <----- value is still sTime +5 hours though I am using GMT

I am in New York so am on EST time.

Missing the obvious...but what is it ?

Thanks,
Chris

-- 
View this message in context: http://r.789695.n4.nabble.com/Time-OffSet-From-GMT-Losing-it-tp2968940p2968940.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list