<?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 Interval in minutes between datetimes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Interval-in-minutes-between-datetimes/m-p/908756#M358567</link>
    <description>&lt;P&gt;Why is SAS doing this? It is obviously wrong:&lt;/P&gt;
&lt;P&gt;t = intck('min', date1, date2);&lt;/P&gt;
&lt;P&gt;date1 is 18feb2023 12:59&lt;/P&gt;
&lt;P&gt;date2 is 18feb 2023 13:20&lt;/P&gt;
&lt;P&gt;The interval should be 21 minutes, but I am getting -699 minutes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I understand it is confused by the military time, but what is the explanation and how to work around this?&lt;/P&gt;
&lt;P&gt;Any thoughts are welcome!&lt;/P&gt;</description>
    <pubDate>Tue, 19 Dec 2023 03:32:46 GMT</pubDate>
    <dc:creator>pink_poodle</dc:creator>
    <dc:date>2023-12-19T03:32:46Z</dc:date>
    <item>
      <title>Interval in minutes between datetimes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Interval-in-minutes-between-datetimes/m-p/908756#M358567</link>
      <description>&lt;P&gt;Why is SAS doing this? It is obviously wrong:&lt;/P&gt;
&lt;P&gt;t = intck('min', date1, date2);&lt;/P&gt;
&lt;P&gt;date1 is 18feb2023 12:59&lt;/P&gt;
&lt;P&gt;date2 is 18feb 2023 13:20&lt;/P&gt;
&lt;P&gt;The interval should be 21 minutes, but I am getting -699 minutes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I understand it is confused by the military time, but what is the explanation and how to work around this?&lt;/P&gt;
&lt;P&gt;Any thoughts are welcome!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 03:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Interval-in-minutes-between-datetimes/m-p/908756#M358567</guid>
      <dc:creator>pink_poodle</dc:creator>
      <dc:date>2023-12-19T03:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Interval in minutes between datetimes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Interval-in-minutes-between-datetimes/m-p/908758#M358568</link>
      <description>&lt;P&gt;Check the actual values of DATE1 and DATE2.&amp;nbsp; The values you showed are 21 minutes apart.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  date1 ='18feb2023 12:59'dt;
  date2 ='18feb2023 13:20'dt;
  diff1 = intck('min',date1,date2);
  diff2 = intck('min',date1,date2,'c');
  diff3 = (date2-date1)/60;
  format date1 date2 datetime19.;
run;
proc print;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs                  date1                  date2    diff1    diff2    diff3

 1      18FEB2023:12:59:00     18FEB2023:13:20:00      21       21       21
&lt;/PRE&gt;
&lt;P&gt;To get -699 minutes you would have had to mistakenly coded the second date as 1:20 AM instead of 1:20 PM.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  date1 ='18feb2023 12:59'dt;
  date2 ='18feb2023 13:20'dt;
  date3 = date1 - 699*60;
  diff1 = intck('min',date1,date2);
  diff2 = intck('min',date1,date2,'c');
  diff3 = (date2-date1)/60;
  format date1-date3 datetime19.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1702957269142.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/91710i3323D2E8A4DC2FA5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Tom_0-1702957269142.png" alt="Tom_0-1702957269142.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 03:41:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Interval-in-minutes-between-datetimes/m-p/908758#M358568</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-12-19T03:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Interval in minutes between datetimes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Interval-in-minutes-between-datetimes/m-p/908930#M358600</link>
      <description>Yes, this is exactly what happened, thank you!</description>
      <pubDate>Tue, 19 Dec 2023 21:07:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Interval-in-minutes-between-datetimes/m-p/908930#M358600</guid>
      <dc:creator>pink_poodle</dc:creator>
      <dc:date>2023-12-19T21:07:19Z</dc:date>
    </item>
  </channel>
</rss>

