[R] time zones in POSIXt

Dirk Eddelbuettel edd at debian.org
Fri Apr 23 22:52:27 CEST 2004


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]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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




More information about the R-help mailing list