Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Timezone names are not as simple as you would like. See <a href="http://en.wikipedia.org/wiki/Tz_database" rel="nofollow">http://en.wikipedia.org/wiki/Tz_database</a> for background and <a href="http://en.wikipedia.org/wiki/List_of_tz_database_time_zones" rel="nofollow">http://en.wikipedia.org/wiki/List_of_tz_database_time_zones</a> for a list of the names that are used. By far the best thing is to use the <code>tz = 'country / city'</code> notation and to explicitly set the time zone of the local system.</p> <p>So, here's a script that uses two different methods to encode the time zone:</p> <pre><code>Sys.setenv(TZ='GMT') pst.abr &lt;- as.POSIXct('2011-01-10 06:45:00', tz = 'PST') est.abr &lt;- as.POSIXct('2011-01-10 09:45:00', tz = 'EST') pst.country.city &lt;- as.POSIXct('2011-01-10 06:45:00', tz = 'America/Los_Angeles') est.country.city &lt;- as.POSIXct('2011-01-10 09:45:00', tz = 'America/New_York') </code></pre> <p>If we look at the POSIXct values that we would have like to have been PST, we see that they actually have two different values. Starting with the abbreviation (<code>tz ='PST'</code>), you get this:</p> <pre><code>&gt; pst.abr [1] "2011-01-10 06:45:00 UTC" &gt; as.numeric(pst.abr) [1] 1294641900 </code></pre> <p>You see that the data we defined using <code>tz='PST'</code> isn't actually in the PST timezone, but has inherited the system's timezone. </p> <p>Compare this to the data we defined using the country\city:</p> <pre><code>&gt; as.numeric(pst.country.city) [1] 1294670700 &gt; pst.country.city [1] "2011-01-10 06:45:00 PST" </code></pre> <p>So, only the data that we explicitly encode with country/city information has the correct timezone information.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload