[R] Fwd: as.POSIXlt() Function

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Thu Oct 23 04:46:42 CEST 2014


Because PST8PDT probably is not a valid TZ on your operating system. Try "America/LosAngeles"
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On October 22, 2014 2:35:55 AM PDT, Vasantha Kumar Kesavan <info.vasukv at gmail.com> wrote:
>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]]
>
>______________________________________________
>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