<?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: Compare two datetime values in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271718#M4597070</link>
    <description>&lt;P&gt;Hi Artem,&lt;/P&gt;&lt;P&gt;another option would be to use the "formatDate" helper to convert the dates to a unix millisecond timestamp and then compare those numeric values with the greater than or lower than helpers:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;{{#gt (formatDate "01-31-2020" "x") (formatDate "01-30-2020" "x") }}
...
{{/gt}}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;BR /&gt;Jonas&lt;/P&gt;</description>
    <pubDate>Fri, 07 Aug 2020 11:15:28 GMT</pubDate>
    <dc:creator>JonasB</dc:creator>
    <dc:date>2020-08-07T11:15:28Z</dc:date>
    <item>
      <title>Compare two datetime values</title>
      <link>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaq-p/12271713</link>
      <description>&lt;P&gt;Hello everyone, &lt;/P&gt;
  &lt;P&gt;I have a scenario where I need to compare (two datetime entity values) | (datetime entity with api response date), is it currently possible? Maybe there are helpers like for date formating &lt;A href="https://help.sap.com/viewer/a4522a393d2b4643812b7caadfe90c18/latest/en-US/b4f08a9a66434327a405b6934880445c.html"&gt;https://help.sap.com/viewer/a4522a393d2b4643812b7caadfe90c18/latest/en-US/b4f08a9a66434327a405b6934880445c.html&lt;/A&gt; ?&lt;/P&gt;
  &lt;P&gt;Thank you! &lt;/P&gt;
  &lt;P&gt;Best Regards, &lt;/P&gt;
  &lt;P&gt;Artem &lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 22:22:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaq-p/12271713</guid>
      <dc:creator>former_member496802</dc:creator>
      <dc:date>2020-08-06T22:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two datetime values</title>
      <link>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271714#M4597066</link>
      <description>&lt;P&gt;Hi Artem,&lt;/P&gt;&lt;P&gt;what would you like to compare? Which date is older, which date is "younger"?&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Andreas&lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2020 05:21:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271714#M4597066</guid>
      <dc:creator>alichtenau</dc:creator>
      <dc:date>2020-08-07T05:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two datetime values</title>
      <link>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271715#M4597067</link>
      <description>&lt;P&gt;HI &lt;SPAN class="mention-scrubbed"&gt;artem.sharganov&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;There is compare helper available, I believe you want to compare api response date with a static date, then you can use this&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;{{#compare (formatDate api_service_response.InvoiceByDate.body.d.results.[0].InvoiceDate 'DD-MM-YYYY') '===' '01-05-2018'}}
    Dates are equal
{{else}} 
    Not equal
{{/compare}}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards &lt;BR /&gt;Kishore&lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2020 05:41:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271715#M4597067</guid>
      <dc:creator>former_member671720</dc:creator>
      <dc:date>2020-08-07T05:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two datetime values</title>
      <link>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271716#M4597068</link>
      <description>&lt;P&gt;Hi Andreas, &lt;/P&gt;&lt;P&gt;Yes, that is right. The complete scenario is the following: &lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I am getting the response from api with date field. &lt;/LI&gt;&lt;LI&gt;I need to compare (younger, older) it with a current datetime. Current datettime I am getting from {{message_received_at}}&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Thanks! &lt;/P&gt;&lt;P&gt;Best Regards, &lt;/P&gt;&lt;P&gt;Artem &lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2020 09:07:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271716#M4597068</guid>
      <dc:creator>former_member496802</dc:creator>
      <dc:date>2020-08-07T09:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two datetime values</title>
      <link>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271717#M4597069</link>
      <description>&lt;P&gt;HI @kishore96, &lt;/P&gt;&lt;P&gt;Good idea, thank you! &lt;/P&gt;&lt;P&gt;I think if I format the datetime like "YYYY.MM.DD", javascript operators can help to compare (younger, older) two datetimes even if values are strings. It should work because of the &lt;B&gt;lexicographical order. &lt;/B&gt;&lt;/P&gt;&lt;P&gt;Do I miss any case when it doesn't work?  What do you think?&lt;/P&gt;&lt;P&gt;Best Regards, &lt;/P&gt;&lt;P&gt;Artem &lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2020 09:30:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271717#M4597069</guid>
      <dc:creator>former_member496802</dc:creator>
      <dc:date>2020-08-07T09:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two datetime values</title>
      <link>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271718#M4597070</link>
      <description>&lt;P&gt;Hi Artem,&lt;/P&gt;&lt;P&gt;another option would be to use the "formatDate" helper to convert the dates to a unix millisecond timestamp and then compare those numeric values with the greater than or lower than helpers:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;{{#gt (formatDate "01-31-2020" "x") (formatDate "01-30-2020" "x") }}
...
{{/gt}}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;BR /&gt;Jonas&lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2020 11:15:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271718#M4597070</guid>
      <dc:creator>JonasB</dc:creator>
      <dc:date>2020-08-07T11:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two datetime values</title>
      <link>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271719#M4597071</link>
      <description>&lt;P&gt;By the way: To get the current timestamp, you can use the formatDate helper without providing a date. So if I understand your requirement correctly, it would look like this&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;{{#gt (formatDate memory.myDateVar "x") (formatDate "x") }}
...
{{/gt}}&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Aug 2020 11:18:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271719#M4597071</guid>
      <dc:creator>JonasB</dc:creator>
      <dc:date>2020-08-07T11:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two datetime values</title>
      <link>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271720#M4597072</link>
      <description>&lt;P&gt;Hi Jonas, &lt;/P&gt;&lt;P&gt;It is what I need! Thank you! &lt;/P&gt;&lt;P&gt;Best Regards, &lt;/P&gt;&lt;P&gt;Artem &lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2020 11:26:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271720#M4597072</guid>
      <dc:creator>former_member496802</dc:creator>
      <dc:date>2020-08-07T11:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two datetime values</title>
      <link>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271721#M4597073</link>
      <description>&lt;P&gt;Hi  &lt;SPAN class="mention-scrubbed"&gt;artem.sharganov&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;I have tried using javascript operators like "===" or "&amp;lt;=" or  "&amp;gt;=" in the compare helper and all the use cases with different dates which i tired are working fine, I am not sure about the case where this method does not work.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;{{#compare (formatDate api_response.Date 'YYYY-MM-DD') '&amp;lt;=' '2018-05-02'}}
   yes the date is less
 {{else}}
   not less
{{/compare}}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I Think comparing numeric values is better which is suggested by Jonas.&lt;/P&gt;&lt;P&gt;Regards &lt;BR /&gt;Kishore&lt;/P&gt;</description>
      <pubDate>Sat, 08 Aug 2020 06:26:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/compare-two-datetime-values/qaa-p/12271721#M4597073</guid>
      <dc:creator>former_member671720</dc:creator>
      <dc:date>2020-08-08T06:26:16Z</dc:date>
    </item>
  </channel>
</rss>

