[R] POSIXct time zone and daylight savings issues
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Oct 31 10:24:02 CET 2006
On Mon, 30 Oct 2006, Sebastian P. Luque wrote:
> Hi again,
>
> A related issue I can't quite understand is:
>
>
> R> tt <- as.POSIXct("2006-05-24", tz="EEST")
> R> tt
> [1] "2006-05-24 EEST"
> R> seq(tt, length=12, by="months")
> [1] "2006-05-24 EEST" "2006-06-24 EEST" "2006-07-24 EEST" "2006-08-24 EEST"
> [5] "2006-09-24 EEST" "2006-10-24 EEST" "2006-11-24 EEST" "2006-12-24 EEST"
> [9] "2007-01-24 EEST" "2007-02-24 EEST" "2007-03-24 EEST" "2007-04-24 EEST"
> R> tt <- as.POSIXct("2006-05-24", tz="EET")
> R> seq(tt, length=12, by="months")
> [1] "2006-05-24 EEST" "2006-06-24 EEST" "2006-07-24 EEST" "2006-08-24 EEST"
> [5] "2006-09-24 EEST" "2006-10-24 EEST" "2006-11-24 EET" "2006-12-24 EET"
> [9] "2007-01-24 EET" "2007-02-24 EET" "2007-03-24 EET" "2007-04-24 EEST"
> R> sessionInfo()
> R version 2.4.0 (2006-10-03)
> x86_64-pc-linux-gnu
>
> locale:
> LC_CTYPE=en_CA.UTF-8;LC_NUMERIC=C;LC_TIME=en_CA.UTF-8;LC_COLLATE=en_CA.UTF-8;LC_MONETARY=en_CA.UTF-8;LC_MESSAGES=en_CA.UTF-8;LC_PAPER=en_CA.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_CA.UTF-8;LC_IDENTIFICATION=C
>
> attached base packages:
> [1] "methods" "stats" "graphics" "grDevices" "utils" "datasets"
> [7] "base"
>
> other attached packages:
> lattice
> "0.14-9"
>
>
> i.e. daylight savings 'tzone' attribute gets adjusted automatically when
> providing the standard time attribute, but not when providing the daylight
> savings time. Does this behaviour depend on the OS/locale? Should the
> 'tz' argument supplied when creating POSIXct objects always be the
> standard time version?
No, it should be a timezone, and the timezone specification includes when
DST is in effect. See ?as.POSIXct for details and references of
timezones. For example, EST is a timezone without DST and EST5EDT is a
timezone with DST (and they agree in winter). It looks like Linux is
interpreting EEST as UTC+3 throughout the year (which appears not to be
used anywhere as an actual timezone). So the behaviour is clear: EEST
does not have DST, and $isdst == 0 in that 'timezone', whereas EET does
have DST.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list