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
On Tue, 31 Oct 2006 09:24:02 + (GMT),
Prof Brian Ripley [EMAIL PROTECTED] wrote:
[...]
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
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]
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
Hello,
Suppose we need a function that takes a POSIXct object and need to
calculate the time difference between it and GMT time:
gmtDiff - function(time) {
time.gmt - as.POSIXct(format(time, tz=GMT))
time.plt - as.POSIXlt(time)
dlstime - ifelse(time.plt$isdst 0, 1, 0)
timezone
Try this:
gmtDiff - function(time) time - as.POSIXct(format(time), tz = GMT)
gmtDiff(Sys.time())
gmtDiff(as.POSIXct(2006-10-27, tz = GMT))
which both give me the correct answer currently.
The expression after the minus sign comes from the table at the end
of the help desk article in R News
On Fri, 27 Oct 2006 14:55:15 -0400,
Gabor Grothendieck [EMAIL PROTECTED] wrote:
Try this: gmtDiff - function(time) time - as.POSIXct(format(time), tz =
GMT)
gmtDiff(Sys.time()) gmtDiff(as.POSIXct(2006-10-27, tz = GMT))
which both give me the correct answer currently.
The expression after