[R] as.Date(Sys.time()) returns tomorrow !

ce zadig_1 at excite.com
Fri Jun 20 05:24:02 CEST 2014


I guessed it too, but my command 

as.Date(Sys.time(),tz="EDT")
[1] "2014-06-20"

doesn't give warning message you got for PDT . I thought EDT was a valid TZ !
Now I changed it to :
> as.Date(Sys.time(),tz="America/New_York")
[1] "2014-06-19"

Thanks. 

-----Original Message-----
From: "William Dunlap" [wdunlap at tibco.com]
Date: 06/19/2014 11:10 PM
To: "ce" <zadig_1 at excite.com>
CC: r-help at r-project.org
Subject: Re: [R] as.Date(Sys.time()) returns tomorrow !

Is it a time zone issue?  I get:

R> Sys.time()
[1] "2014-06-19 20:09:25 PDT"
R> as.Date(Sys.time())
[1] "2014-06-20"
R> as.Date(Sys.time(),tz="US/Pacific")
[1] "2014-06-19"
R> as.Date(Sys.time(),tz="PDT")
[1] "2014-06-20"
Warning message:
In as.POSIXlt.POSIXct(x, tz = tz) : unknown timezone 'PDT'
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Thu, Jun 19, 2014 at 7:22 PM, ce <zadig_1 at excite.com> wrote:
> Dear all,
>
>> Sys.time()
> [1] "2014-06-19 22:19:17.976818 EDT"
>
>> as.Date(Sys.time())
> [1] "2014-06-20"
>>
>
>
> why this happens ?
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list