<?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 Difference between two date by field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-two-date-by-field/m-p/480025#M134552</link>
    <description>&lt;P&gt;Hello,This is my query &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| loadjob savedsearch="myquery"
|where strftime(_time, "%Y-%m-%d") = "2020-02-24"
|eval show=if(STEP="show",strftime(_time, "%Y-%m-%d %H:%M:%S"),NULL),click=if(STEP="Click",strftime(_time, "%Y-%m-%d %H:%M:%S"),NULL)
|stats max(show) as show ,min(click) as click by client
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have two date : show and click&lt;BR /&gt;
i want to calculate the difference between the two date by client &lt;/P&gt;

&lt;P&gt;Exemple of the result :&lt;/P&gt;

&lt;P&gt;client : RYU5890&lt;BR /&gt;
Show : 2020-02-24 10:15:00&lt;BR /&gt;
click: 2020-02-24 10:20:00&lt;BR /&gt;
Diff: 5&lt;/P&gt;

&lt;P&gt;client : FH5Y411&lt;BR /&gt;
Show : 2020-02-24 09:20:00&lt;BR /&gt;
click: 2020-02-24 09:21:00&lt;BR /&gt;
Diff: 1&lt;/P&gt;</description>
    <pubDate>Thu, 27 Feb 2020 15:59:06 GMT</pubDate>
    <dc:creator>tahasefiani</dc:creator>
    <dc:date>2020-02-27T15:59:06Z</dc:date>
    <item>
      <title>Difference between two date by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-two-date-by-field/m-p/480025#M134552</link>
      <description>&lt;P&gt;Hello,This is my query &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| loadjob savedsearch="myquery"
|where strftime(_time, "%Y-%m-%d") = "2020-02-24"
|eval show=if(STEP="show",strftime(_time, "%Y-%m-%d %H:%M:%S"),NULL),click=if(STEP="Click",strftime(_time, "%Y-%m-%d %H:%M:%S"),NULL)
|stats max(show) as show ,min(click) as click by client
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have two date : show and click&lt;BR /&gt;
i want to calculate the difference between the two date by client &lt;/P&gt;

&lt;P&gt;Exemple of the result :&lt;/P&gt;

&lt;P&gt;client : RYU5890&lt;BR /&gt;
Show : 2020-02-24 10:15:00&lt;BR /&gt;
click: 2020-02-24 10:20:00&lt;BR /&gt;
Diff: 5&lt;/P&gt;

&lt;P&gt;client : FH5Y411&lt;BR /&gt;
Show : 2020-02-24 09:20:00&lt;BR /&gt;
click: 2020-02-24 09:21:00&lt;BR /&gt;
Diff: 1&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 15:59:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-two-date-by-field/m-p/480025#M134552</guid>
      <dc:creator>tahasefiani</dc:creator>
      <dc:date>2020-02-27T15:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two date by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-two-date-by-field/m-p/480026#M134553</link>
      <description>&lt;P&gt;Give these a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| loadjob savedsearch="myquery"
 |where strftime(_time, "%Y-%m-%d") = "2020-02-24"
 |eval show=if(STEP="show",_time, null()) ,click=if(STEP="click",_time, null()) 
 |stats max(show) as show ,min(click) as click by client
 | eval Diff=tostring(click-show,"duration")
| convert ctime(click) ctime(show)  timeformat="%Y-%m-%d %H:%M:%S"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| loadjob savedsearch="myquery"
|where strftime(_time, "%Y-%m-%d") = "2020-02-24"
| eval {STEP}=_time
|stats max(show) as show ,min(click) as click by client
| eval Diff=tostring(click-show,"duration")
| convert ctime(click) ctime(show)  timeformat="%Y-%m-%d %H:%M:%S"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Feb 2020 21:04:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-two-date-by-field/m-p/480026#M134553</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-02-27T21:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two date by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-two-date-by-field/m-p/480027#M134554</link>
      <description>&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 15:37:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-two-date-by-field/m-p/480027#M134554</guid>
      <dc:creator>tahasefiani</dc:creator>
      <dc:date>2020-02-28T15:37:33Z</dc:date>
    </item>
  </channel>
</rss>

