<?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 How to compare close date with start date? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-close-date-with-start-date/m-p/615355#M213851</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;I am new to this kind of analysis within Splunk but i've been asked to create a filter on events where the closed date is before the start date.&lt;/P&gt;
&lt;P&gt;This is the search I have created but can't get it working:&lt;/P&gt;
&lt;P&gt;index=main sourcetype="CRA_Consumer_Txt_data" | eval close_date=strftime(strptime(close_date,"%d%m%Y"),"%d/%m/%Y") | eval start_date=strftime(strptime(start_date,"%d%m%Y"),"%d/%m/%Y") | search close_date &amp;lt; start_date | table start_date, close_date&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is an example of what even is shown when i run that search&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;start_date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;close_date&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;30/04/2021&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;23/05/2021&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Sep 2022 14:40:24 GMT</pubDate>
    <dc:creator>vishalduttauk</dc:creator>
    <dc:date>2022-09-30T14:40:24Z</dc:date>
    <item>
      <title>How to compare close date with start date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-close-date-with-start-date/m-p/615355#M213851</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;I am new to this kind of analysis within Splunk but i've been asked to create a filter on events where the closed date is before the start date.&lt;/P&gt;
&lt;P&gt;This is the search I have created but can't get it working:&lt;/P&gt;
&lt;P&gt;index=main sourcetype="CRA_Consumer_Txt_data" | eval close_date=strftime(strptime(close_date,"%d%m%Y"),"%d/%m/%Y") | eval start_date=strftime(strptime(start_date,"%d%m%Y"),"%d/%m/%Y") | search close_date &amp;lt; start_date | table start_date, close_date&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is an example of what even is shown when i run that search&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;start_date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;close_date&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;30/04/2021&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;23/05/2021&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 14:40:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-close-date-with-start-date/m-p/615355#M213851</guid>
      <dc:creator>vishalduttauk</dc:creator>
      <dc:date>2022-09-30T14:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Compare close date with start date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-close-date-with-start-date/m-p/615356#M213852</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;You are quite close. When you are comparing dates it should always convert to epoch and then do the comparison.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=main sourcetype="CRA_Consumer_Txt_data" 
| eval close_date_epoch = strptime(close_date,"%d%m%Y") 
| eval start_date_epoch = strptime(start_date,"%d%m%Y")
| where close_date_epoch &amp;lt; start_date_epoch
| eval close_date = strftime(close_date_epoch, "%d/%m/%Y"),
       start_date = strftime(start_date_epoch, "%d/%m/%Y")
| table start_date, close_date&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 30 Sep 2022 10:12:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-close-date-with-start-date/m-p/615356#M213852</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-09-30T10:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Compare close date with start date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-close-date-with-start-date/m-p/615358#M213854</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;that has worked a treat and I now know to use epoch for this type of comparison!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 10:19:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-close-date-with-start-date/m-p/615358#M213854</guid>
      <dc:creator>vishalduttauk</dc:creator>
      <dc:date>2022-09-30T10:19:08Z</dc:date>
    </item>
  </channel>
</rss>

