[R] POSIXlt and daylight savings time
Jeff Newmiller
jdnewmil at dcn.davis.CA.us
Wed Sep 5 05:16:39 CEST 2012
a) Don't use POSIXlt in data frames... use POSIXct. POSIXlt is like a data frame of its own, and data frames within data frames lead to surprising results, to say the least.
b) I have had best luck using Sys.setenv( TZ="Etc/GMT+8" ) for US Pacific Standard Time as "local" time for the duration of analysis.
c) Use the format argument if you want consistent results.
---------------------------------------------------------------------------
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.
pdb <philb at philbrierley.com> wrote:
>I have a data frame that contains dates, but when I use as.POSIXlt() I
>lose
>the hours on all records. I traced this down to a particuar hour which
>causes the issue...
>
>> as.POSIXlt('2004-10-31 02:00:00')
>[1] "2004-10-31"
>> as.POSIXlt('2004-10-31 03:00:00')
>[1] "2004-10-31 03:00:00"
>
>How do I tell as.POSIXlt() to ignore daylight savings and just convert
>to a
>time as is? I've read about the 'isdst' but it is still unclear what to
>do.
>
>This is a cleaned up date field that I received so adjusting the date
>itself
>is not possible.
>
>Thanks in advance.
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/POSIXlt-and-daylight-savings-time-tp4642253.html
>Sent from the R help mailing list archive at Nabble.com.
>
>______________________________________________
>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