Thank you for the lead, Dirk! Indeed this works on my machine too: > as.POSIXct("2000-05-10 10:15:00", tz="PST8PDT") - as.POSIXct("2000-05-10 10:15:00", tz="GMT") Time difference of 7 hours
However when I replace POSIXct by POSIXlt it breaks (this looks like a bug to me): > as.POSIXlt("2000-05-10 10:15:00", tz="PST8PDT") - as.POSIXlt("2000-05-10 10:15:00", tz="GMT") Time difference of 0 secs Now a couple of new questions: * how could I learn about appropriate names for time zones? For example I was using "PST" whereas it seems I had to use either "PST8" or "PST8PDT". Why "PST" was not good? Is it documented anywhere? * there seems to be no difference betweeen GMT and BST on my machine though PST8 and PST8PDT are treated properly: # PST8 is not identical to PST8PDT > ISOdatetime(2003, seq(12), 1, 10, 0, 0, tz="PST8") - ISOdatetime(2003, seq(12), 1, 10, 0, 0, tz="PST8PDT") Time differences of 0, 0, 0, 0, 3600, 3600, 3600, 3600, 3600, 3600, 0, 0 secs # GMT0 is identical to BST > ISOdatetime(2003, seq(12), 1, 10, 0, 0, tz="GMT0") - ISOdatetime(2003, seq(12), 1, 10, 0, 0, tz="BST") Time differences of 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 secs Why is such dichotomy? Thanks, Vadim > -----Original Message----- > From: Dirk Eddelbuettel [mailto:[EMAIL PROTECTED] > Sent: Friday, April 23, 2004 1:52 PM > To: Vadim Ogranovich > Cc: R-Help > Subject: Re: [R] time zones in POSIXt > > > > On Fri, Apr 23, 2004 at 11:30:19AM -0700, Vadim Ogranovich wrote: > > Hi, > > > > I have two data sources. One records time in PST time zone, > the other > > in GMT. I want to compute the difference between the two, but don't > > see how. Here is an example where I compute time difference between > > identical times each (meant to be) relative to its time zone. > > > > > as.POSIXlt("2000-05-10 10:15:00", "PST") - > as.POSIXlt("2000-05-10 > > 10:15:00", "GMT") > > Time difference of 0 secs > > > > I was expecting to see 8hrs (which is the time difference between > > London and San-Francisco). Why is it so and what is the > correct way of > > doing it? > > Seems to work with POSIXct in 1.8.1 and 1.9.0: > > > as.POSIXct("2000-05-10 10:15:00", "PST8PDT") - > > as.POSIXct("2000-05-10 > 10:15:00", tz="UTC") > Time difference of 7 hours > > > Dirk > > > > > > > I use R-1.8.1 on RH-7.3. > > > > Thanks, > > Vadim > > > > > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > [EMAIL PROTECTED] mailing list > > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide! > > http://www.R-project.org/posting-guide.html > > > > -- > The relationship between the computed price and reality is as > yet unknown. > -- From the > pac(8) manual page > ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html