<?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 subtract two time fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375581#M162893</link>
    <description>&lt;P&gt;Try this run anywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval EndTime="2/14/2018 9:28:19", BeginTime="2/6/2018 14:53:45"|eval EndTime=strptime(EndTime,"%m/%d/%Y %H:%M:%S"), BeginTime=strptime(BeginTime,"%m/%d/%Y %H:%M:%S")|eval days=round((EndTime-BeginTime)/86400)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 14 Feb 2018 17:42:12 GMT</pubDate>
    <dc:creator>493669</dc:creator>
    <dc:date>2018-02-14T17:42:12Z</dc:date>
    <item>
      <title>How to subtract two time fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375580#M162892</link>
      <description>&lt;P&gt;How would I go about subtracting EndTime from BeginTime?&lt;/P&gt;

&lt;P&gt;&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/4386i383D5E610C4BE6C2/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 17:34:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375580#M162892</guid>
      <dc:creator>cotyp</dc:creator>
      <dc:date>2018-02-14T17:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract two time fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375581#M162893</link>
      <description>&lt;P&gt;Try this run anywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval EndTime="2/14/2018 9:28:19", BeginTime="2/6/2018 14:53:45"|eval EndTime=strptime(EndTime,"%m/%d/%Y %H:%M:%S"), BeginTime=strptime(BeginTime,"%m/%d/%Y %H:%M:%S")|eval days=round((EndTime-BeginTime)/86400)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Feb 2018 17:42:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375581#M162893</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-14T17:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract two time fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375582#M162894</link>
      <description>&lt;P&gt;hello there,&lt;BR /&gt;
try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... your search ...
|eval end_time_epoch = strptime(EndTime, "%m/%d/%Y %H:%M:%S")
|eval begin_time_epoch = strptime(BeginTime, "%m/%d/%Y %H:%M:%S")
| eval duration = end_time_epoch - begin_time_epoch
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;hope it helps&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 17:45:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375582#M162894</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-02-14T17:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract two time fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375583#M162895</link>
      <description>&lt;P&gt;how would you go about getting results in minutes?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 20:38:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375583#M162895</guid>
      <dc:creator>cotyp</dc:creator>
      <dc:date>2018-02-14T20:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract two time fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375584#M162896</link>
      <description>&lt;P&gt;How would I make the epoch time human readable? Results to display in a manner such as, 8d 15 hrs 20 minutes?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 20:39:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375584#M162896</guid>
      <dc:creator>cotyp</dc:creator>
      <dc:date>2018-02-14T20:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract two time fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375585#M162897</link>
      <description>&lt;P&gt;try this at the end of your query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | eval "duration_Days+HHMMSS" = tostring(duration, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Feb 2018 21:20:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375585#M162897</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-02-14T21:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract two time fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375586#M162898</link>
      <description>&lt;P&gt;to get results in min divide the difference(in sec.) by 60&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...|eval minutes=round((EndTime-BeginTime)/60)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 03:02:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375586#M162898</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-15T03:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract two time fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375587#M162899</link>
      <description>&lt;P&gt;if you want duration in &lt;CODE&gt;day&lt;/CODE&gt; &lt;CODE&gt;hr&lt;/CODE&gt; and &lt;CODE&gt;min&lt;/CODE&gt; then try this run anywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval EndTime="2/14/2018 9:28:19", BeginTime="2/6/2018 14:53:45"|eval EndTime=strptime(EndTime,"%m/%d/%Y %H:%M:%S"), BeginTime=strptime(BeginTime,"%m/%d/%Y %H:%M:%S")| eval stringSecs = tostring((EndTime-BeginTime), "duration")| eval stringSecss = replace(stringSecs,"(\d+)\+(\d+)\:(\d+)\:.*","\1d \2h \3min ")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 03:30:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375587#M162899</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-15T03:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract two time fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375588#M162900</link>
      <description>&lt;P&gt;thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 14:13:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375588#M162900</guid>
      <dc:creator>cotyp</dc:creator>
      <dc:date>2018-02-15T14:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract two time fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375589#M162901</link>
      <description>&lt;P&gt;Glad to help you:) Please accept the answer as well.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 14:16:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-subtract-two-time-fields/m-p/375589#M162901</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-15T14:16:57Z</dc:date>
    </item>
  </channel>
</rss>

