[R] Does strptime(...,tz="GMT") do anything?

David Forrest drf5n at maplepark.com
Mon Jan 8 23:48:32 CET 2007


Hi All

In trying to correlate some tide gauge data I need to deal with varying 
timezones.  From the documentation on strptime, it seemed that the tz 
variable might have some effect on the conversion, but I'm not seeing an 
effect.

> strptime("20061201 1:02 PST",format="%Y%m%d %H:%M",tz="PST")+0
[1] "2006-12-01 01:02:00 EST"
> strptime("20061201 1:02 PST",format="%Y%m%d %H:%M",tz="")+0
[1] "2006-12-01 01:02:00 EST"
> strptime("20061201 1:02 PST",format="%Y%m%d %H:%M",tz="GMT")+0
[1] "2006-12-01 01:02:00 EST"
> strptime("20061201 1:02 PST",format="%Y%m%d %H:%M",tz="UTC")+0
[1] "2006-12-01 01:02:00 EST"
> strptime("20061201 1:02 PST",format="%Y%m%d %H:%M",tz="EST")+0
[1] "2006-12-01 01:02:00 EST"

What is the recommended way of handling this?  Computing and adding 
offsets manually?

> strptime("20061201 1:02 PST",format="%Y%m%d %H:%M",tz="UTC")+3600*3
[1] "2006-12-01 04:02:00 EST"

Or am I doing something wrong with the strptime(..., tz="EST") function?

Thanks for your time,
Dave
-- 
  Dr. David Forrest
  drf at vims.edu                                    (804)684-7900w
  drf5n at maplepark.com                             (804)642-0662h
                                    http://maplepark.com/~drf5n/



More information about the R-help mailing list