<?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 Find Avg Diff two Date fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Find-Avg-Diff-two-Date-fields/m-p/53063#M12902</link>
    <description>&lt;P&gt;Splunkers,&lt;/P&gt;

&lt;P&gt;I have events from our Helpdesk ticketing system that have two date fields, DateOpen and DateClosed, both with the following format:&lt;BR /&gt;
2013-02-25 12:50&lt;BR /&gt;
2013-02-26 12:58&lt;/P&gt;

&lt;P&gt;I am trying to write a report that shows average time from when the ticket was opened and when it was closed. Based on research, i think i need to convert these to epoch time using mktime and then do the subtraction, then convert back to ctime. Unfortunately, i cant get mktime to return any values.&lt;/P&gt;

&lt;P&gt;convert timeformat="%y/%m/%d %H-%M" mktime(DateClosed) AS closedon_epoch | table DateClosed, closedon_epoch&lt;/P&gt;

&lt;P&gt;Am i missing something here or am i going about this the wrong way? Thanks in advance for any help.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 13:27:17 GMT</pubDate>
    <dc:creator>I-Man</dc:creator>
    <dc:date>2020-09-28T13:27:17Z</dc:date>
    <item>
      <title>Find Avg Diff two Date fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-Avg-Diff-two-Date-fields/m-p/53063#M12902</link>
      <description>&lt;P&gt;Splunkers,&lt;/P&gt;

&lt;P&gt;I have events from our Helpdesk ticketing system that have two date fields, DateOpen and DateClosed, both with the following format:&lt;BR /&gt;
2013-02-25 12:50&lt;BR /&gt;
2013-02-26 12:58&lt;/P&gt;

&lt;P&gt;I am trying to write a report that shows average time from when the ticket was opened and when it was closed. Based on research, i think i need to convert these to epoch time using mktime and then do the subtraction, then convert back to ctime. Unfortunately, i cant get mktime to return any values.&lt;/P&gt;

&lt;P&gt;convert timeformat="%y/%m/%d %H-%M" mktime(DateClosed) AS closedon_epoch | table DateClosed, closedon_epoch&lt;/P&gt;

&lt;P&gt;Am i missing something here or am i going about this the wrong way? Thanks in advance for any help.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:27:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-Avg-Diff-two-Date-fields/m-p/53063#M12902</guid>
      <dc:creator>I-Man</dc:creator>
      <dc:date>2020-09-28T13:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: Find Avg Diff two Date fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-Avg-Diff-two-Date-fields/m-p/53064#M12903</link>
      <description>&lt;P&gt;strptime is the way i'd do it ...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval open_epoch=strptime(DateOpen,"%Y-%m-%d %H:%M") 
    | eval close_epoch=strptime(DateClosed,"%Y-%m-%d %H:%M")
    | eval duration=tostring(close_epoch-open_epoch,"duration")
    | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Mar 2013 16:32:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-Avg-Diff-two-Date-fields/m-p/53064#M12903</guid>
      <dc:creator>jonuwz</dc:creator>
      <dc:date>2013-03-06T16:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Find Avg Diff two Date fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-Avg-Diff-two-Date-fields/m-p/53065#M12904</link>
      <description>&lt;P&gt;Perfect, thanks!!!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2013 22:06:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-Avg-Diff-two-Date-fields/m-p/53065#M12904</guid>
      <dc:creator>I-Man</dc:creator>
      <dc:date>2013-03-06T22:06:28Z</dc:date>
    </item>
  </channel>
</rss>

