[R] how to calculate time offset between timezones?

dankelley Dan.Kelley at dal.ca
Thu Jan 10 16:21:15 CET 2008


#QUESTION#

Is there a way to calculate the offset between timezones, e.g. from "AST" to
"GMT"?

#DETAILS# 

I am working with data files that use local time, and that indicate the
timezone by e.g. "AST" (Atlantic Standard Time, my local time) in a header. 
I was guessing that

> ISOdatetime(2008,1,1,1,0,0,tz="GMT") -
> ISOdatetime(2008,1,1,1,0,0,tz="AST")

would work, but it gives a difference of 0.  However, when I do

> ISOdatetime(2008,1,1,1,0,0,tz="GMT") - ISOdatetime(2008,1,1,1,0,0)

I get a -4h offset, which is correct.  The odd thing is, I am in AST time,
as shown by the following.

> ISOdatetime(2008,1,1,1,0,0)
[1] "2008-01-01 01:00:00 AST"

#SYSTEM#

Mac OS X system, with R 2.6.1 

#PS#

I am aware that this sort of thing is system dependent, and so there may not
be a general solution.  But even if I can only get it working on my own
particular system, I'd be happy!
-- 
View this message in context: http://www.nabble.com/how-to-calculate-time-offset-between-timezones--tp14736453p14736453.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list