[R] POSIXct time zone and daylight savings issues

Gabor Grothendieck ggrothendieck at gmail.com
Mon Oct 30 18:57:21 CET 2006


I don't know the answer to your question but if you are using dates
with no times and don't need time zones (both of which appear to
be the case here) then you could use "Date"
class and avoid the issue altogether.  See the help desk article in
R News 4/1 where there is a discussion of how to choose the
date time class.

On 10/30/06, Sebastian P. Luque <spluque at gmail.com> 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?
>
>
> Cheers,
>
> --
> Seb
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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