[R] date conversion not as i would have expected

clair.crossupton at googlemail.com clair.crossupton at googlemail.com
Wed Oct 21 16:51:34 CEST 2009


Good day, i imported some data into R from Excel.  By using the edit()
function, this is what one of the dates looks like in R:

> x <- structure(1254351600, class = c("POSIXt", "POSIXct"), tzone = "")
[1] "2009-10-01 BST"

However, when i do the following, the date changes:

> as.Date(x, formate="%Y-%m-%d" )
[1] "2009-09-30"

I don't understand why this is happening. I realise that i can get
around this by doing as.Date(as.character(x)), but would be nice to
understand why it doesn't work directly.

C xx




More information about the R-help mailing list