<?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>Question Re: How to Determine Date difference in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/how-to-determine-date-difference/qaa-p/13832497#M4863340</link>
    <description>&lt;P&gt;You're right. It  might need some adjustments to get it working properly&lt;/P&gt;</description>
    <pubDate>Thu, 29 Sep 2022 02:10:52 GMT</pubDate>
    <dc:creator>fvestjens</dc:creator>
    <dc:date>2022-09-29T02:10:52Z</dc:date>
    <item>
      <title>How to Determine Date difference</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-determine-date-difference/qaq-p/13832492</link>
      <description>&lt;P&gt;I have two dates of the structure Start Date: 2007-03-24, End Date: 2009-06-26&lt;/P&gt;
&lt;P&gt;Presently I want to track down the difference between these two in the beneath structure:&lt;/P&gt;
&lt;P&gt;2 years, 90 days, and 2 days &lt;/P&gt;
&lt;P&gt;I Have gone through the procedure described &lt;A href="https://www.scaler.com/topics/date-difference-in-sql/" target="_blank"&gt;here&lt;/A&gt; but I'm a Little bit scared if I tried wrong. Can someone give some insight here ?&lt;/P&gt;</description>
      <pubDate>Sat, 24 Sep 2022 08:17:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-determine-date-difference/qaq-p/13832492</guid>
      <dc:creator>former_SQLA_member1695027</dc:creator>
      <dc:date>2022-09-24T08:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to Determine Date difference</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-determine-date-difference/qaa-p/13832495#M4863338</link>
      <description>&lt;P&gt;I suggest you post what you've tried so far to get some feedback.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Sep 2022 12:41:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-determine-date-difference/qaa-p/13832495#M4863338</guid>
      <dc:creator>justin_willey</dc:creator>
      <dc:date>2022-09-24T12:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to Determine Date difference</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-determine-date-difference/qaa-p/13832493#M4863336</link>
      <description>&lt;P&gt;It's hard to say what eyactly you need, have you tried casting the strings to DATE and using the &lt;A href="https://help.sap.com/docs/SAP_SQL_Anywhere/93079d4ba8e44920ae63ffb4def91f5b/81f669d06ce21014bfebf31372827e90.html?version=17.0&amp;amp;locale=en-US&amp;amp;q=days"&gt;DAYS function&lt;/A&gt; of Anywhere?&lt;/P&gt;</description>
      <pubDate>Sun, 25 Sep 2022 11:00:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-determine-date-difference/qaa-p/13832493#M4863336</guid>
      <dc:creator>former_SQLA_member1694901</dc:creator>
      <dc:date>2022-09-25T11:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to Determine Date difference</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-determine-date-difference/qaa-p/13832494#M4863337</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;create or replace function DateDifference(in in_StartDate date,in in_EndDate date)
returns varchar(64)
begin
 declare l_Years integer;
 declare l_Months integer;
 declare l_Days integer;
 declare l_Date date;

 select datediff(year,in_StartDate,in_Enddate) into l_Years;

 set l_Date = dateAdd(year,l_years,in_startDate);
 select datediff(month,l_Date,in_EndDate) into l_Months;

 set l_Date = dateAdd(month,l_months,l_Date);
 select datediff(day,l_Date,in_EndDate) into l_Days

 return (if l_Years &amp;gt; 0 then l_Years ||' years ' endif) ||
        (if l_Months &amp;gt; 0 then l_Months ||' months' endif) ||
        (if l_Days &amp;gt; 0 then ' and '|| l_Days ||' days' endif) 
end
&lt;/PRE&gt;

&lt;P&gt;select DateDifference('2007-03-24','2009-06-26') will return &lt;STRONG&gt;2 years, 3 months and 2 days&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2022 03:04:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-determine-date-difference/qaa-p/13832494#M4863337</guid>
      <dc:creator>fvestjens</dc:creator>
      <dc:date>2022-09-26T03:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to Determine Date difference</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-determine-date-difference/qaa-p/13832496#M4863339</link>
      <description>&lt;P&gt;Note that this will not work correctly for all dates. &lt;/P&gt;
&lt;P&gt;If the second date has a lower value for either MONTH or DAY, it will ignore the MONTH and/or DAY.
  DateDifference('2022-11-30','2022-12-01') // returns 1 month 
  DateDifference('2022-12-31','2023-01-01') // returns 1 year&lt;/P&gt;
&lt;P&gt;Both of these should be 1 day.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 18:25:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-determine-date-difference/qaa-p/13832496#M4863339</guid>
      <dc:creator>chris_keating</dc:creator>
      <dc:date>2022-09-28T18:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to Determine Date difference</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-determine-date-difference/qaa-p/13832497#M4863340</link>
      <description>&lt;P&gt;You're right. It  might need some adjustments to get it working properly&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 02:10:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-determine-date-difference/qaa-p/13832497#M4863340</guid>
      <dc:creator>fvestjens</dc:creator>
      <dc:date>2022-09-29T02:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to Determine Date difference</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-determine-date-difference/qaa-p/13832498#M4863341</link>
      <description>&lt;P&gt;It would probably be easy to swap dates internally if StartDate is before EndDate and "negate" the result then.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 04:18:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-determine-date-difference/qaa-p/13832498#M4863341</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2022-09-29T04:18:16Z</dc:date>
    </item>
  </channel>
</rss>

