Dear R People:

Here is an interesting question:

library(chron)
xt <- seq.dates(from="01/01/2004",by="days",length=5)
xt
[1] 01/01/04 01/02/04 01/03/04 01/04/04 01/05/04

#Fine so far
as.POSIXct(xt)
[1] "2003-12-31 18:00:00 Central Standard Time"
[2] "2004-01-01 18:00:00 Central Standard Time"
[3] "2004-01-02 18:00:00 Central Standard Time"
[4] "2004-01-03 18:00:00 Central Standard Time"
[5] "2004-01-04 18:00:00 Central Standard Time"

Why do the dates change, please? Presumably the as.POSIXct is taking the xt as midnight GMT and converting to Central Standard Time.

Is the best solution to:
as.POSIXlt(xt, "CST")
[1] "2004-01-01 CST" "2004-01-02 CST" "2004-01-03 CST" "2004-01-04 CST"
[5] "2004-01-05 CST"


Thanks in advance!

Sincerely,
Laura Holt
who is corrupted by dates and times
mailto: [EMAIL PROTECTED]


download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to