<?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 Re: Convert UTC timestamp string to date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-UTC-timestamp-string-to-date/m-p/900255#M355796</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/77163"&gt;@Oligolas&lt;/a&gt;&amp;nbsp;Oh! The &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p0py1o500c7qsen1hnn2crgejaig.htm" target="_self"&gt;datetime informat&lt;/A&gt; can also deal with AM/PM. Didn't realize this and it makes things of course even easier.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/332114"&gt;@PROCDATARUN&lt;/a&gt;&amp;nbsp;Use what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/77163"&gt;@Oligolas&lt;/a&gt;&amp;nbsp;proposed.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Oct 2023 01:10:20 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2023-10-27T01:10:20Z</dc:date>
    <item>
      <title>Convert UTC timestamp string to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-UTC-timestamp-string-to-date/m-p/900080#M355728</link>
      <description>&lt;P&gt;Hello SAS Community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Running into the following result when attempting to convert &lt;U&gt;&lt;STRONG&gt;character&lt;/STRONG&gt;&lt;/U&gt; UTC Date to Datefield.&lt;/P&gt;
&lt;P&gt;Input data&lt;/P&gt;
&lt;P&gt;ActivationUTC =&amp;nbsp;08-FEB-23 10.54.32 PM UTC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(INPUT(t2.ActivationUTC , datetime20.)) FORMAT=DESDFDT7. AS ActivationDate&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Output data&amp;nbsp; =&amp;nbsp;18Jul19&lt;/P&gt;
&lt;P&gt;Expected data = 08Feb23&lt;/P&gt;
&lt;P&gt;Can you correct my code ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 06:08:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-UTC-timestamp-string-to-date/m-p/900080#M355728</guid>
      <dc:creator>PROCDATARUN</dc:creator>
      <dc:date>2023-10-26T06:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: Convert UTC timestamp string to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-UTC-timestamp-string-to-date/m-p/900084#M355730</link>
      <description>&lt;P&gt;Code like below should work for you.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  ActivationUTC = '08-FEB-23 10.54.32 PM UTC';
  format want_dttm datetime20.;
  want_dttm=input(ActivationUTC,datetime18.);
  if findw(ActivationUTC,'PM') then
    want_dttm=want_dttm + 43200;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;A SAS datetime value is the count of seconds since 01Jan1960. If PM is found in the source string then half a day gets added to the SAS datetime value (43200 seconds).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no specific SAS informat for your source string and it also doesn't comply with any ISO pattern. It especially doesn't contain any time offset so be aware that the SAS value will be for Zulu time. You will need to increase/decrease the SAS datetime value for your time zone if that's what you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 07:31:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-UTC-timestamp-string-to-date/m-p/900084#M355730</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-10-26T07:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: Convert UTC timestamp string to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-UTC-timestamp-string-to-date/m-p/900085#M355731</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;it's one step easyer actually:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
ActivationUTC = '08-FEB-23 10.54.32 PM UTC';
wantdt = input(ActivationUTC,datetime21.);
format wantdt datetime21.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Oct 2023 08:10:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-UTC-timestamp-string-to-date/m-p/900085#M355731</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2023-10-26T08:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Convert UTC timestamp string to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-UTC-timestamp-string-to-date/m-p/900086#M355732</link>
      <description>&lt;P&gt;You learn something every day. I thought this would be a perfect job for a picture informat...but there is no such thing...?&lt;/P&gt;
&lt;P&gt;Either I can't find it now, or there shoud be a ballot entry for this. Or is this use case too narrow?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 08:21:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-UTC-timestamp-string-to-date/m-p/900086#M355732</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-10-26T08:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Convert UTC timestamp string to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-UTC-timestamp-string-to-date/m-p/900255#M355796</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/77163"&gt;@Oligolas&lt;/a&gt;&amp;nbsp;Oh! The &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p0py1o500c7qsen1hnn2crgejaig.htm" target="_self"&gt;datetime informat&lt;/A&gt; can also deal with AM/PM. Didn't realize this and it makes things of course even easier.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/332114"&gt;@PROCDATARUN&lt;/a&gt;&amp;nbsp;Use what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/77163"&gt;@Oligolas&lt;/a&gt;&amp;nbsp;proposed.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 01:10:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-UTC-timestamp-string-to-date/m-p/900255#M355796</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-10-27T01:10:20Z</dc:date>
    </item>
  </channel>
</rss>

