<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic UTC offset for historical data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/UTC-offset-for-historical-data/m-p/764250#M242051</link>
    <description>&lt;P&gt;I'm getting historical data (back 20+ years) that contains UTC times that I need to convert to local time.&amp;nbsp; The local UTC offset is different depending on the time of year - for me, either seven or eight hours.&amp;nbsp; It seems like the "new" TIMEZONEU2S function only works with the current days UTC offset.&amp;nbsp; Is there a way to get this done directly in SAS?&lt;/P&gt;</description>
    <pubDate>Thu, 26 Aug 2021 15:39:54 GMT</pubDate>
    <dc:creator>PeteLund</dc:creator>
    <dc:date>2021-08-26T15:39:54Z</dc:date>
    <item>
      <title>UTC offset for historical data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/UTC-offset-for-historical-data/m-p/764250#M242051</link>
      <description>&lt;P&gt;I'm getting historical data (back 20+ years) that contains UTC times that I need to convert to local time.&amp;nbsp; The local UTC offset is different depending on the time of year - for me, either seven or eight hours.&amp;nbsp; It seems like the "new" TIMEZONEU2S function only works with the current days UTC offset.&amp;nbsp; Is there a way to get this done directly in SAS?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 15:39:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/UTC-offset-for-historical-data/m-p/764250#M242051</guid>
      <dc:creator>PeteLund</dc:creator>
      <dc:date>2021-08-26T15:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: UTC offset for historical data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/UTC-offset-for-historical-data/m-p/764254#M242052</link>
      <description>&lt;P&gt;Some example values, expected result and possibly the location may be helpful to getting a better response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should likely provide examples where the TIMEZONEU2S is not returning the expected value along with the code you used to do the conversion.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 15:58:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/UTC-offset-for-historical-data/m-p/764254#M242052</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-26T15:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: UTC offset for historical data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/UTC-offset-for-historical-data/m-p/764286#M242060</link>
      <description>&lt;P&gt;Here's a little data step with a couple date/times from my real data and the resulting log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp; format OldDT ConvertedDT datetime13.;&lt;BR /&gt;&amp;nbsp; input OldDate mmddyy10. + 1 OldTime time5.;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; OldDT = dhms(OldDate,0,0,OldTime);&lt;BR /&gt;&amp;nbsp; ConvertedDT = TZONEU2S(OldDT);&lt;/P&gt;&lt;P&gt;&amp;nbsp; put _all_;&lt;BR /&gt;datalines;&lt;BR /&gt;04/09/2016 20:22&lt;BR /&gt;03/02/2018 22:38&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OldDT=09APR16:20:22 ConvertedDT=09APR16:13:22 OldDate=20553 OldTime=73320 _ERROR_=0 _N_=1&lt;BR /&gt;OldDT=02MAR18:22:38 ConvertedDT=02MAR18:15:38 OldDate=21245 OldTime=81480 _ERROR_=0 _N_=2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The current UTC offset for Seattle (where I am) is currently -7 and all the conversions done by the TZONEU2S function use that offset.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would have been -7 on 04/09/2016, so the first row in the log is correct.&amp;nbsp; But it would have been -8 on 03/02/2018, so row 2 is wrong - the ConvertedDT should be&amp;nbsp;02MAR18:14:38.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 17:36:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/UTC-offset-for-historical-data/m-p/764286#M242060</guid>
      <dc:creator>PeteLund</dc:creator>
      <dc:date>2021-08-26T17:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: UTC offset for historical data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/UTC-offset-for-historical-data/m-p/764290#M242062</link>
      <description>&lt;P&gt;According to the doc, &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/n1ien0skr1u9swn1f00w7hizdg9c.htm" target="_self"&gt;TZONEU2S should apply daylight savings rules&lt;/A&gt;.&amp;nbsp; I guess you're not seeing that?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 17:58:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/UTC-offset-for-historical-data/m-p/764290#M242062</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2021-08-26T17:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: UTC offset for historical data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/UTC-offset-for-historical-data/m-p/764291#M242063</link>
      <description>&lt;P&gt;Hi Chris -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No, it doesn't seem to be using the daylight savings rules.&amp;nbsp; If I use that function on the thousands of records I have, covering every day for the past many years, the converted dates are always 7 hours different from the original.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 18:02:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/UTC-offset-for-historical-data/m-p/764291#M242063</guid>
      <dc:creator>PeteLund</dc:creator>
      <dc:date>2021-08-26T18:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: UTC offset for historical data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/UTC-offset-for-historical-data/m-p/764295#M242067</link>
      <description>&lt;P&gt;Perhaps the issue is 1) the start datetime is not actually UTC or 2) Not applying the timezone correctly:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  format udt ConvertedDT datetime18.;
  input udt is8601dz.;
  ConvertedDT = TZONEU2S(udt,'America/Los_Angeles');
  put udt= converteddt=;
datalines;
2018-02-28T22:38:56+00:00
2018-03-01T22:38:56+00:00
2018-03-02T22:38:56+00:00
2018-03-03T22:38:56+00:00
2018-03-10T22:38:56+00:00
2018-03-11T22:38:56+00:00
2018-04-01T22:38:56+00:00
2018-05-01T22:38:56+00:00
2018-06-01T22:38:56+00:00
run;
&lt;/PRE&gt;
&lt;P&gt;Generates:&lt;/P&gt;
&lt;PRE&gt;udt=28FEB18:22:38:56 ConvertedDT=28FEB18:14:38:56
udt=01MAR18:22:38:56 ConvertedDT=01MAR18:14:38:56
udt=02MAR18:22:38:56 ConvertedDT=02MAR18:14:38:56
udt=03MAR18:22:38:56 ConvertedDT=03MAR18:14:38:56
udt=10MAR18:22:38:56 ConvertedDT=10MAR18:14:38:56
udt=11MAR18:22:38:56 ConvertedDT=11MAR18:15:38:56
udt=01APR18:22:38:56 ConvertedDT=01APR18:15:38:56
udt=01MAY18:22:38:56 ConvertedDT=01MAY18:15:38:56
udt=01JUN18:22:38:56 ConvertedDT=01JUN18:15:38:56

&lt;/PRE&gt;
&lt;P&gt;Included some extra dates, the key ones being 10 and 11 Mar since 11 Mar is the first day of DST&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 18:12:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/UTC-offset-for-historical-data/m-p/764295#M242067</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-26T18:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: UTC offset for historical data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/UTC-offset-for-historical-data/m-p/764298#M242069</link>
      <description>&lt;P&gt;Forcing the time zone (America/Los_Angeles) in the function call did the trick.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks much!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 18:21:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/UTC-offset-for-historical-data/m-p/764298#M242069</guid>
      <dc:creator>PeteLund</dc:creator>
      <dc:date>2021-08-26T18:21:29Z</dc:date>
    </item>
  </channel>
</rss>

