<?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: How to compare a certain date/time in epoch format with a fixed date/time in human readable format? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-certain-date-time-in-epoch-format-with-a-fixed/m-p/210844#M61637</link>
    <description>&lt;P&gt;My understanding is strftime will result in a Formatted string whereas strptime will result in a Parsed timestamp, so if you want to compare timestamps, you will want the value to be a timestamp, not a string.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.5/SearchReference/CommonEvalFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.5/SearchReference/CommonEvalFunctions&lt;/A&gt;&lt;BR /&gt;
(Scroll down to "Date and Time functions")&lt;/P&gt;

&lt;P&gt;I think if you try strptime like in this answer, it will work:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/37272/compare-two-date.html"&gt;https://answers.splunk.com/answers/37272/compare-two-date.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Sep 2015 14:41:11 GMT</pubDate>
    <dc:creator>aarontimko</dc:creator>
    <dc:date>2015-09-01T14:41:11Z</dc:date>
    <item>
      <title>How to compare a certain date/time in epoch format with a fixed date/time in human readable format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-certain-date-time-in-epoch-format-with-a-fixed/m-p/210843#M61636</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'd like to compare two dates and time (if A&amp;lt;=B):&lt;BR /&gt;
the one, let's call it A, I have it already in epoch time and the second, let's call it B, is a fixed date and time, which is exactly 31-08-2015 23:59:59.&lt;/P&gt;

&lt;P&gt;I tried it like this (converted A in human readable date/time):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval compare = strftime(A, "%d-%m-%Y %T")
| where compare&amp;lt;=B*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but it doesn't work...&lt;/P&gt;

&lt;P&gt;Any suggestion,&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Skender&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2015 14:31:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-certain-date-time-in-epoch-format-with-a-fixed/m-p/210843#M61636</guid>
      <dc:creator>skender27</dc:creator>
      <dc:date>2015-09-01T14:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a certain date/time in epoch format with a fixed date/time in human readable format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-certain-date-time-in-epoch-format-with-a-fixed/m-p/210844#M61637</link>
      <description>&lt;P&gt;My understanding is strftime will result in a Formatted string whereas strptime will result in a Parsed timestamp, so if you want to compare timestamps, you will want the value to be a timestamp, not a string.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.5/SearchReference/CommonEvalFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.5/SearchReference/CommonEvalFunctions&lt;/A&gt;&lt;BR /&gt;
(Scroll down to "Date and Time functions")&lt;/P&gt;

&lt;P&gt;I think if you try strptime like in this answer, it will work:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/37272/compare-two-date.html"&gt;https://answers.splunk.com/answers/37272/compare-two-date.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2015 14:41:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-certain-date-time-in-epoch-format-with-a-fixed/m-p/210844#M61637</guid>
      <dc:creator>aarontimko</dc:creator>
      <dc:date>2015-09-01T14:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a certain date/time in epoch format with a fixed date/time in human readable format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-certain-date-time-in-epoch-format-with-a-fixed/m-p/210845#M61638</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search giving field A in epoch | where A&amp;lt;=strptime("31-08-2015 23:59:59","%d-%m-%Y %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Sep 2015 15:03:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-certain-date-time-in-epoch-format-with-a-fixed/m-p/210845#M61638</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-09-01T15:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare a certain date/time in epoch format with a fixed date/time in human readable format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-certain-date-time-in-epoch-format-with-a-fixed/m-p/210846#M61639</link>
      <description>&lt;P&gt;Thank you! &lt;BR /&gt;
I inserted the "| where" inside the macro I used in the report.&lt;/P&gt;

&lt;P&gt;It works perfectly now!&lt;BR /&gt;
Skender K.  &lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2015 15:15:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-a-certain-date-time-in-epoch-format-with-a-fixed/m-p/210846#M61639</guid>
      <dc:creator>skender27</dc:creator>
      <dc:date>2015-09-01T15:15:38Z</dc:date>
    </item>
  </channel>
</rss>

