[R] Fwd: as.POSIXlt() Function
Vasantha Kumar Kesavan
info.vasukv at gmail.com
Wed Oct 22 11:35:55 CEST 2014
Hi,
I am a new R user and also not sure about the below concern is really a bug,
My concern are listed below,
Look at the below example, when Sys.Date () is called within the as.POSIXlt
() function. Why it is displaying only the date value and the timezone is
selected to UTC even though the TZ variable is set to "PST8PDT". I could
not see this kind of behavior with as.POSIXct () function.
This is happening in both LINUX 32 and 64 bit operating system.
Example:
> version
_
platform i386-redhat-linux-gnu
arch i386
os linux-gnu
system i386, linux-gnu
status
major 2
minor 10.0
year 2009
month 10
day 26
svn rev 50208
language R
version.string R version 2.10.0 (2009-10-26)
> Sys.setenv(TZ="PST8PDT");
> Sys.setenv(ORA_SDTZ="PST8PDT");
>
> Sys.getenv("TZ");
TZ
"PST8PDT"
> Sys.getenv("ORA_SDTZ");
ORA_SDTZ
"PST8PDT"
>
> as.POSIXct(Sys.Date());
[1] "2014-10-20 17:00:00 PDT"
> c(as.POSIXct(Sys.Date()));
[1] "2014-10-20 17:00:00 PDT"
>
> as.POSIXlt(Sys.Date());
[1] "2014-10-21 UTC"
> c(as.POSIXlt(Sys.Date()));
[1] "2014-10-20 17:00:00 PDT"
>
> as.POSIXct(Sys.time());
[1] "2014-10-21 20:59:23 PDT"
> c(as.POSIXct(Sys.time()));
[1] "2014-10-21 20:59:23 PDT"
>
> as.POSIXlt(Sys.time());
[1] "2014-10-21 20:59:23 PDT"
> c(as.POSIXlt(Sys.time()));
[1] "2014-10-21 20:59:23 PDT"
>
Thanks
Vasanth
[[alternative HTML version deleted]]
More information about the R-help
mailing list