<?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: Comparison between Future date and current date in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Comparison-between-Future-date-and-current-date/m-p/331351#M98582</link>
    <description>&lt;P&gt;There seems to be a lot of unneeded churn in your search. Does this work for you?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search 
| eval InFuture=if((now()-_time)&amp;gt;86400,"yes","no") 
| table _time InFuture
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;EDIT: you could change 86400 to 0 to catch anything in the future. Or change to 604800 to catch something 1 week in the future or more.&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2017 13:50:51 GMT</pubDate>
    <dc:creator>twinspop</dc:creator>
    <dc:date>2017-06-09T13:50:51Z</dc:date>
    <item>
      <title>Comparison between Future date and current date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparison-between-Future-date-and-current-date/m-p/331349#M98580</link>
      <description>&lt;P&gt;I have a date field 'Start Time' in csv. I have to filter if date in this field is current week date or future week date. For this I fetch '%W' of the date and current date and comparing. But if the date is future date its '%W' is coming as current week only. It is not considering future dates.&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3026i4D94769DCDB340AA/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Any help will be great!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 10:13:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparison-between-Future-date-and-current-date/m-p/331349#M98580</guid>
      <dc:creator>dsiob</dc:creator>
      <dc:date>2017-06-09T10:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison between Future date and current date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparison-between-Future-date-and-current-date/m-p/331350#M98581</link>
      <description>&lt;P&gt;Why not compare epoch times directly?  If _time &amp;gt; now() then the event is in the future.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 12:50:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparison-between-Future-date-and-current-date/m-p/331350#M98581</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-06-09T12:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison between Future date and current date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparison-between-Future-date-and-current-date/m-p/331351#M98582</link>
      <description>&lt;P&gt;There seems to be a lot of unneeded churn in your search. Does this work for you?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search 
| eval InFuture=if((now()-_time)&amp;gt;86400,"yes","no") 
| table _time InFuture
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;EDIT: you could change 86400 to 0 to catch anything in the future. Or change to 604800 to catch something 1 week in the future or more.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 13:50:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparison-between-Future-date-and-current-date/m-p/331351#M98582</guid>
      <dc:creator>twinspop</dc:creator>
      <dc:date>2017-06-09T13:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison between Future date and current date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparison-between-Future-date-and-current-date/m-p/331352#M98583</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/* source*/ | eval StartTimeDetail=case(strptime('Start Time',"%m/%d/%Y %H:%M")&amp;gt;=relative_time(now(),"@w+7d"),"Future Week",strptime('Start Time',"%m/%d/%Y %H:%M")&amp;gt;=relative_time(now(),"@w"),"This Week",1=1,"Prior Week")
| table "Start Time" StartTimeDetail
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2017 15:05:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparison-between-Future-date-and-current-date/m-p/331352#M98583</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-06-09T15:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison between Future date and current date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparison-between-Future-date-and-current-date/m-p/331353#M98584</link>
      <description>&lt;P&gt;this returns whether the difference is 1 week or not. But I have to show whether _time is in current week or not&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 06:05:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparison-between-Future-date-and-current-date/m-p/331353#M98584</guid>
      <dc:creator>dsiob</dc:creator>
      <dc:date>2017-06-12T06:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison between Future date and current date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparison-between-Future-date-and-current-date/m-p/331354#M98585</link>
      <description>&lt;P&gt;Ohh Superb!! its working&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 06:15:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparison-between-Future-date-and-current-date/m-p/331354#M98585</guid>
      <dc:creator>dsiob</dc:creator>
      <dc:date>2017-06-12T06:15:22Z</dc:date>
    </item>
  </channel>
</rss>

