<?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 can i calculate datetime Difference between two datetime values. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-calculate-datetime-Difference-between-two-datetime/m-p/374634#M169683</link>
    <description>&lt;P&gt;Begin date - 2018-05-02 22:00:23.235371 &lt;BR /&gt;
End Date - 2018-05-02 22:01:33.815546 &lt;/P&gt;

&lt;P&gt;Expected Result should be - 70&lt;/P&gt;</description>
    <pubDate>Thu, 03 May 2018 09:19:06 GMT</pubDate>
    <dc:creator>abhishekgupta61</dc:creator>
    <dc:date>2018-05-03T09:19:06Z</dc:date>
    <item>
      <title>How can i calculate datetime Difference between two datetime values.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-calculate-datetime-Difference-between-two-datetime/m-p/374634#M169683</link>
      <description>&lt;P&gt;Begin date - 2018-05-02 22:00:23.235371 &lt;BR /&gt;
End Date - 2018-05-02 22:01:33.815546 &lt;/P&gt;

&lt;P&gt;Expected Result should be - 70&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 09:19:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-calculate-datetime-Difference-between-two-datetime/m-p/374634#M169683</guid>
      <dc:creator>abhishekgupta61</dc:creator>
      <dc:date>2018-05-03T09:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: How can i calculate datetime Difference between two datetime values.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-calculate-datetime-Difference-between-two-datetime/m-p/374635#M169684</link>
      <description>&lt;P&gt;Hey, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval begin="2018-05-02 22:00:23.235371"
| eval end="2018-05-02 22:01:33.815546"
| eval begin_epoch=strptime(begin, "%Y-%m-%d %H:%M:%S")
| eval end_epoch=strptime(end, "%Y-%m-%d %H:%M:%S")
| eval diff=end_epoch-begin_epoch
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The field &lt;CODE&gt;diff&lt;/CODE&gt; will then contain the difference between the two. I left out the milliseconds on purpose, because you said you expected "70" as a result.&lt;/P&gt;

&lt;P&gt;Hope that helps - if it does I'd be happy if you would upvote/accept this answer, so others could profit from it. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 15:20:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-calculate-datetime-Difference-between-two-datetime/m-p/374635#M169684</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-05-03T15:20:26Z</dc:date>
    </item>
  </channel>
</rss>

