<?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 How to calculate the time difference in minutes between two events? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-time-difference-in-minutes-between-two/m-p/200211#M58028</link>
    <description>&lt;P&gt;I have two events&lt;/P&gt;

&lt;P&gt;I'm using this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;nt_time=strptime(VENDOR_NOTIFIED_TIME,"%F %T")|eval st_time = strptime(START_DATE,"%F %T") |eval latency = nt_time-st_time|
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;start date or vendor notified time looks like this :  &lt;CODE&gt;2016-10-21 18:59:00&lt;/CODE&gt;&lt;BR /&gt;
I want to see results difference in minutes??&lt;/P&gt;</description>
    <pubDate>Mon, 31 Oct 2016 14:18:28 GMT</pubDate>
    <dc:creator>msachdeva3</dc:creator>
    <dc:date>2016-10-31T14:18:28Z</dc:date>
    <item>
      <title>How to calculate the time difference in minutes between two events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-time-difference-in-minutes-between-two/m-p/200211#M58028</link>
      <description>&lt;P&gt;I have two events&lt;/P&gt;

&lt;P&gt;I'm using this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;nt_time=strptime(VENDOR_NOTIFIED_TIME,"%F %T")|eval st_time = strptime(START_DATE,"%F %T") |eval latency = nt_time-st_time|
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;start date or vendor notified time looks like this :  &lt;CODE&gt;2016-10-21 18:59:00&lt;/CODE&gt;&lt;BR /&gt;
I want to see results difference in minutes??&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2016 14:18:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-time-difference-in-minutes-between-two/m-p/200211#M58028</guid>
      <dc:creator>msachdeva3</dc:creator>
      <dc:date>2016-10-31T14:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the time difference in minutes between two events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-time-difference-in-minutes-between-two/m-p/200212#M58029</link>
      <description>&lt;P&gt;turn them into epoch time before calculating the difference. If fields are already in epoch, you can just calculate the difference without converting them.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|convert mktime(VENDOR_NOTIFIED_TIME) as nt_time timeformat="%Y-%m-%d %H:%M:%S"|convert mktime(START_DATE) as st_time timeformat="%Y-%m-%d %H:%M:%S"|eval latency = nt_time-st_time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Oct 2016 14:24:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-time-difference-in-minutes-between-two/m-p/200212#M58029</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2016-10-31T14:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the time difference in minutes between two events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-time-difference-in-minutes-between-two/m-p/200213#M58030</link>
      <description>&lt;P&gt;Assuming you're not getting your latency field populated here, are both VENDOR_NOTIFIED_TIME and START_DATE field appear in separate events? If yes, then you would need to join those two events using some common field.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:34:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-time-difference-in-minutes-between-two/m-p/200213#M58030</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T11:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the time difference in minutes between two events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-time-difference-in-minutes-between-two/m-p/200214#M58031</link>
      <description>&lt;P&gt;convert mktime(VENDOR_NOTIFIED_TIME) as nt_time timeformat="%Y/%m/%d %H:%M:%S"|convert mktime(START_DATE) as st_time timeformat="%Y/%m/%d %H:%M:%S"|&lt;/P&gt;

&lt;P&gt;tried displaying results with table command&lt;BR /&gt;
|table nt_time st_time |head 5&lt;/P&gt;

&lt;P&gt;these fields are empty i.e not working&lt;BR /&gt;
unable to convert time i guess&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:37:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-time-difference-in-minutes-between-two/m-p/200214#M58031</guid>
      <dc:creator>msachdeva3</dc:creator>
      <dc:date>2020-09-29T11:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the time difference in minutes between two events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-time-difference-in-minutes-between-two/m-p/200215#M58032</link>
      <description>&lt;P&gt;what format are those fields in originally? are they in "%Y-%m-%d %H:%M:%S" or are they in another format?&lt;/P&gt;

&lt;P&gt;I just updated the syntax. I misread the format you had listed in the question. Changed format to have "-" instead of "/". If it isn't in that format, please share what original format the fields are in.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2016 14:50:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-time-difference-in-minutes-between-two/m-p/200215#M58032</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2016-10-31T14:50:22Z</dc:date>
    </item>
  </channel>
</rss>

