Skip to content

removing daylight savings in R

2 messages · Rhiannon Marchant, Brian Ripley

#
Hi all,
   I've been having some trouble with times in regards to daylight savings in R
   version 2.8.1.  I have an ORACLE database that R is importing data in from,
   for the 2am and 2:30am time intervals for the dates that daylight savings
   starts the times are getting read as NA values into R. I'm also finding that
   if  I  open a R workspace from version 6.2.2,the datetimes are getting
   converted to daylight savings times.  The times are a cruical part of my
   analysis and need to stay in standard time. I would like to be using a newer
   version of R than I am currently using (2.6.2) so that I can make use of the
   newer packages that are available, however with this problem of the time
   conversions I am unable to do this. Is anyone able to help with to set up
   R2.8.1 to use standard time instead of daylight savings times?
   The session info for R 2.8.1 is:
   R version 2.8.1 (2008-12-22)
   i386-pc-mingw32
   locale:
   LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MONETAR
   Y=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252
   attached base packages:
   [1] stats     graphics  grDevices utils     datasets  methods   base
   and for 2.6.2 is:
   R version 2.6.2 (2008-02-08)
   i386-pc-mingw32
   locale:
   LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MONETAR
   Y=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252
   attached base packages:
   [1] stats     graphics  grDevices utils     datasets  tcltk     methods
   [8] base
   other attached packages:
   [1] svSocket_0.9-5 svIO_0.9-5     R2HTML_1.59    svMisc_0.9-5   svIDE_0.9-5
   Regards
   Rhiannon
   Rhiannon Marchant
   Forecasting Analyst
   Wholesale
   Synergy (ABN: 71 743 446 839), 228 Adelaide Tce, Perth, WA, 6000, Australia
   phone:   (08)   6212   1464   |   fax:   (08)   6212   1036  |  email:
   rhiannon.marchant at synergy.net.au
   business  enquiries:  131354 | identification no.: 300794  |  website:
   [1]synergy.net.au
   Please consider the environment before printing this email.

   ========================================================================
   SYNERGY. ABN 71 743 446 839, Perth, Western Australia.
   Telephone: +61 8 6212 2222
   TO THE ADDRESSEE: Unencrypted E-mail is not secure and may not be authentic.
    We cannot guarantee the accuracy,
   reliability, completeness or confidentiality of this E-mail and any attachme
   nts ("E-Mail").
   The e-mail system used for this communication is based on Western Standard T
   ime.
   Please check all times carefully if they are important to the context of the
    communication.
   IF YOU ARE NOT THE INTENDED ADDRESSEE: This E-Mail is intended solely forthe
    intended addressee and may be subject
   to legal or other professional privilege, or may contain information that is
    confidential or exempt from
   disclosure by law. Copying or distributing this E-Mail or any information it
    may contain, by anyone other than the
   intended addressee, is prohibited. If you have received this E-Mail in error
    please notify us immediately by return
   e-mail or by telephone; and destroy this E-Mail and any electronic or hard c
   opies of it. Any claim to privilege or
   confidentiality is not waived or lost by reason of mistaken transmission of
   this E-Mail.
   VIRUSES: Although we scan all outgoing e-mail and attachments for viruses, w
   e cannot guarantee that viruses will not
   be transmitted with this E-mail. It is the recipient's responsibility to che
   ck this E-Mail for viruses.
   ========================================================================

References

   1. http://www.synergy.net.au/
#
What do you mean by 'standard time'? If you mean UTC, set TZ=UTC. 
For anything else, see ?Sys.timezone (which explains the use of TZ).

I am guessing that you are storing times in "POSIXct" objects (you do 
not say): they are in UTC.  Have you any evidence that 'datetimes are 
getting converted to daylight savings times'?  More likely they are 
getting *printed* in your local timezone, because that is the 
documented default behaviour.  But you can change it (see 
?format.POSIXct).

You are attributing self-will to R in 'an ORACLE database that R is 
importing data in from': it is merely following instructions.  We 
don't have those instructions and there is no sign of a package that 
could do this in your sessionInfo (R itself has no such facilities). 
If the Oracle database is not in your local timezone (which seems to 
be the case) you will need to tell the import facilty what time it is 
in.  If the (non-R) import facility does this right, the datetimes 
will be marked as being in UTC (or whatever), and most of the time 
printed as such (but I would always do so explicitly).

The difference betwee 2.6.2 and later versions is that lots of bugs in 
the way Windows handles timezones were fixed, so it sounds as if you 
have been relying on a Windows bug.
On Fri, 27 Feb 2009, Rhiannon Marchant wrote:

            
[...]