[R] Problem with GMT+/- time zones

Andrew Digby andrewdigby at mac.com
Thu Feb 2 21:57:51 CET 2012


Wow. Thanks very much for pointing that out - I never would have guessed it was deliberate that + and - were reversed!

For future reference for anyone else similarly confused by this departure from time zone and mathematic convention, here's the relevant part of en.wikipedia.org/wiki/Tz_database:

"The special area of Etc is used for some administrative zones, particularly for "Etc/UTC" which represents Coordinated Universal Time. In order to conform with the POSIX style, those zone names beginning with "Etc/GMT" have their sign reversed from what most people expect. In this style, zones west of GMT have a positive sign and those east have a negative sign in their name (e.g "Etc/GMT-14" is 14 hours ahead/east of GMT.)"

Thanks,

Andrew


On 2/02/2012, at 20:46 , Jeff Newmiller wrote:

> Should has nothing to do with it. That is the way the Olsen tz database works.  See en.wikipedia.org/wiki/Tz_database.
> ---------------------------------------------------------------------------
> Jeff Newmiller                        The     .....       .....  Go Live...
> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
>                                      Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
> --------------------------------------------------------------------------- 
> Sent from my phone. Please excuse my brevity.
> 
> Andrew Digby <andrewdigby at mac.com> wrote:
> 
>> 
>> I'm struggling with time zone version when expressed as hours offset
>> from GMT. Can anyone confirm that the behaviour below is incorrect? It
>> seems that the GMT offsets are backwards:
>> 
>>> format(as.POSIXct("2011-05-23 17:23:00",
>> tz="Europe/London"),tz="America/New_York",usetz=T)
>> [1] "2011-05-23 12:23:00 EDT"
>> 
>> - this works.
>> 
>>> format(as.POSIXct("2011-05-23 17:23:00",tz="GMT"),tz="GMT-5",usetz=T)
>> [1] "2011-05-23 22:23:00 GMT"
>> 
>> - this doesn't work: 17:23:00 GMT should be 12:23:00 GMT-5!
>> 
>> 
>> Thanks.
>> 
>> 
>> R version 2.13.0 (2011-04-13)
>> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
>> 
>> ______________________________________________
>> 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.
>



More information about the R-help mailing list