zzz1 is POSIXct so looking at:
> as.Date.POSIXct
function (x, ...)
{
z <- floor(unclass(x)/86400)
attr(z, "tzone") <- NULL
structure(z, class = "Date")
}
we see as.Date.POSIXct takes the POSIXct object, zzz1, and converts it
to Date relative to GMT. There is no time zone argument on
e answer.
>
> Usually one has x=y --> f(x)=f(y)
>
> which doesn't seem to hold here (put x=zzz1, y=zzz2, f=as.Date()).
>
> Or do I overlook something?
>
>
> - Original Message - From: "Marek Janad"
> To:
> Sent: Thursday, December 24, 20
Mark, not sure that's the answer.
Usually one has x=y --> f(x)=f(y)
which doesn't seem to hold here (put x=zzz1, y=zzz2, f=as.Date()).
Or do I overlook something?
- Original Message -
From: "Marek Janad"
To:
Sent: Thursday, December 24, 2009 00:08
S
Look at documentation
?as.Date
as.Date first represents time in UTC, what gives:
as.POSIXlt(zzz1, tz="UTC")
HTH
2009/12/20 MAL :
> All!
>
> This piece of code:
>
> zzz1 <- as.POSIXct("1999-03-18", tz="CET")
> zzz2 <- as.POSIXlt("1999-03-18", tz="CET")
> zzz1 == zzz2
> as.Date(zzz1)
> as.Date(z
I don't know the details of why this is happening, but in any case it
is a good idea to round() your times if you want to convert them to
dates. Just as you would round() a numeric value to convert it to an
integer.
as.Date(round(zzz1, "days"))
2009/12/21 Jason Morgan :
> Hello,
>
> On 2009.12.2
All!
This piece of code:
zzz1 <- as.POSIXct("1999-03-18", tz="CET")
zzz2 <- as.POSIXlt("1999-03-18", tz="CET")
zzz1 == zzz2
as.Date(zzz1)
as.Date(zzz2)
yields TRUE for "zzz1==zzz2", but the two dates returned by as.Date are
different:
as.Date(zzz1)
[1] "1999-03-17"
as.Date(zzz2)
[1] "199
Hello,
On 2009.12.20 18:06:17, MAL wrote:
> All!
>
> This piece of code:
>
> zzz1 <- as.POSIXct("1999-03-18", tz="CET")
> zzz2 <- as.POSIXlt("1999-03-18", tz="CET")
> zzz1 == zzz2
> as.Date(zzz1)
> as.Date(zzz2)
>
> yields TRUE for "zzz1==zzz2", but the two dates returned by as.Date are
> diff
All!
This piece of code:
zzz1 <- as.POSIXct("1999-03-18", tz="CET")
zzz2 <- as.POSIXlt("1999-03-18", tz="CET")
zzz1 == zzz2
as.Date(zzz1)
as.Date(zzz2)
yields TRUE for "zzz1==zzz2", but the two dates returned by as.Date are
different:
> as.Date(zzz1)
[1] "1999-03-17"
> as.Date(zzz2)
[1] "1999-
8 matches
Mail list logo