Prof Brian Ripley <[EMAIL PROTECTED]> writes: > On Fri, 1 Sep 2006, Peter Dalgaard wrote: > > [...] > > > I'm not sure any of this is actual bugs (Brian will tell us soon > > enough), but it does appear at least to be underdocumented. > > (Your message crossed mine.) > > I think it is not a bug and actually explicitly documented in ?as.POSIXlt. > What may help those who have not read that documentation is to stick the > UTC timezone on the conversion to POSIXlt. Getting
Hmmm, which part of ?as.POSIXlt didn't I understand? I can't seem to spot anything pointing to -lt being different from -ct conversion (in a week-old version of r-devel). What I do see is: The 'as.POSIX*' functions convert an object to one of the two classes used to represent date/times (calendar dates plus time to the nearest second). They can convert a wide variety of objects, including objects of the other class and of classes '"Date"', '"date"' (from package 'date' or 'survival'), '"chron"' and '"dates"' (from package 'chron') to these classes. Dates are treated as being at midnight UTC. The last sentence would appear not to be true for as.POSIXlt; dates are treated as midnight in the _current_ timezone ignoring DST (which of course is undetectable in Oxford because that _is_ UTC in your timezone) . > > as.POSIXlt(Sys.Date()) > [1] "2006-09-01 UTC" > > as.POSIXct(as.POSIXlt(Sys.Date())) > [1] "2006-09-01 UTC" > > as.POSIXct(as.POSIXlt(Sys.Date()), tz="") > [1] "2006-09-01 01:00:00 GMT Daylight Time" > > might be helpful to non-readers. I have > as.POSIXct(as.POSIXlt(Sys.Date()), tz="") [1] "2006-09-01 01:00:00 CEST" and of course the whole issue is that > dput(as.POSIXlt(Sys.Date(), tz="UTC")) structure(list(sec = 0, min = 0, hour = 0, mday = 1, mon = 8, year = 106, wday = 5, yday = 243, isdst = 0), .Names = c("sec", "min", "hour", "mday", "mon", "year", "wday", "yday", "isdst" ), class = c("POSIXt", "POSIXlt")) > dput(as.POSIXlt(Sys.Date())) structure(list(sec = 0, min = 0, hour = 0, mday = 1, mon = 8, year = 106, wday = 5, yday = 243, isdst = 0), .Names = c("sec", "min", "hour", "mday", "mon", "year", "wday", "yday", "isdst" ), class = c("POSIXt", "POSIXlt")) are exactly the same -- the tz arg is ignored. The documentation in ?POSIXlt does have some hints about POSIXlt being converted to current locale, but I still find the whole thing a bit unclear. -- O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel