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.
On Oct 8, 2010, at 3:43 PM, rivercode wrote:> > 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 GMTNo, ... it's not. > 1204572601-1204554601 == 60*60*5 [1] TRUE ----> 5 hours difference and also == sTime> > 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. > > ______________________________________________ > R-help at 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.David Winsemius, MD West Hartford, CT
That is embarrassing....thanks for pointing out my mistake. Chris -- View this message in context: http://r.789695.n4.nabble.com/Time-OffSet-From-GMT-Losing-it-tp2968940p2990987.html Sent from the R help mailing list archive at Nabble.com.
Reasonably Related Threads
- Adding a survival object to a data frame (PR#10510)
- [PATCH 03/23] drm/i915: Don't use struct drm_driver.get_scanout_position()
- [PATCH 01/23] drm: Add get_scanout_position() to struct drm_crtc_helper_funcs
- [PATCH v4 5/5] x86, kvm: support vcpu preempted check
- [PATCH v4 5/5] x86, kvm: support vcpu preempted check