[R] puzzled by time zone quirk

Denis Chabot chabot.denis at gmail.com
Sun Sep 21 15:11:54 CEST 2014


Hi,

I have to deal with time-stamped data coming from outside my own time zone, so the problem is likely poor knowledge of European time zones on my part. But I am puzzled just the same.

I thought that setting a time zone of "Europe/Copenhagen" would be the same as "CET" in winter and "CEST" in summer.

This test in winter works as expected:

> a = as.POSIXct("2013-02-25 01:00:00", tz="Europe/Copenhagen"); a
[1] "2013-02-25 01:00:00 CET"
> b = as.POSIXct("2013-02-25 01:00:00", tz="CET"); b
[1] "2013-02-25 01:00:00 CET"
> a-b
Time difference of 0 secs

But this one is summer does not work as I expected:

> c = as.POSIXct("2013-07-25 01:00:00", tz="Europe/Copenhagen"); c
[1] "2013-07-25 01:00:00 CEST"
> d = as.POSIXct("2013-07-25 01:00:00", tz="CEST"); d
[1] "2013-07-25 01:00:00 UTC"
> e = as.POSIXct("2013-07-25 01:00:00", tz="CET"); e
[1] "2013-07-25 01:00:00 CEST"
> c-d
Time difference of -2 hours
> c-e
Time difference of 0 secs

Setting tz to "Europe/Copenhagen" in summer in c first appears to be the same as setting it to "CEST" because the output is showing "CEST".

But d should then be the same as c, and it is not.

What is happening?

Thanks in advance,

Denis Chabot



More information about the R-help mailing list