<?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 Calculate difference between 2 timestamps in days? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Calculate-difference-between-2-timestamps-in-days/m-p/485144#M83043</link>
    <description>&lt;P&gt;i 'm trying to calculate the difference between two timestamps in number of days. here is my query&lt;BR /&gt;
base_search&lt;BR /&gt;
| eval intime = strptime(minTime, "%Y-%m-%dT%H:%M:%S") &lt;BR /&gt;
| eval outtime = strptime(maxTime, "%Y-%m-%dT%H:%M:%S") &lt;BR /&gt;
| eval timediffindays = tostring((outtime - intime), "duration") &lt;/P&gt;

&lt;P&gt;my timestamp filed looks like "2019-09-23T18:51:52+0000" &lt;/P&gt;

&lt;P&gt;my outcome looks like " 367+01:43:52.000000"  &lt;/P&gt;

&lt;P&gt;i am expecting to see the results in number of days&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Azmath&lt;/P&gt;</description>
    <pubDate>Mon, 23 Sep 2019 18:55:26 GMT</pubDate>
    <dc:creator>AzmathShaik</dc:creator>
    <dc:date>2019-09-23T18:55:26Z</dc:date>
    <item>
      <title>Calculate difference between 2 timestamps in days?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Calculate-difference-between-2-timestamps-in-days/m-p/485144#M83043</link>
      <description>&lt;P&gt;i 'm trying to calculate the difference between two timestamps in number of days. here is my query&lt;BR /&gt;
base_search&lt;BR /&gt;
| eval intime = strptime(minTime, "%Y-%m-%dT%H:%M:%S") &lt;BR /&gt;
| eval outtime = strptime(maxTime, "%Y-%m-%dT%H:%M:%S") &lt;BR /&gt;
| eval timediffindays = tostring((outtime - intime), "duration") &lt;/P&gt;

&lt;P&gt;my timestamp filed looks like "2019-09-23T18:51:52+0000" &lt;/P&gt;

&lt;P&gt;my outcome looks like " 367+01:43:52.000000"  &lt;/P&gt;

&lt;P&gt;i am expecting to see the results in number of days&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Azmath&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 18:55:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Calculate-difference-between-2-timestamps-in-days/m-p/485144#M83043</guid>
      <dc:creator>AzmathShaik</dc:creator>
      <dc:date>2019-09-23T18:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between 2 timestamps in days?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Calculate-difference-between-2-timestamps-in-days/m-p/485145#M83044</link>
      <description>&lt;P&gt;What &lt;CODE&gt;tostring&lt;/CODE&gt; gave you &lt;EM&gt;is&lt;/EM&gt; a number of days.  It also expressed the remainder in terms of hours, minutes, and seconds.&lt;BR /&gt;
If you only want days, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval intime = strptime(minTime, "%Y-%m-%dT%H:%M:%S")
| eval outtime = strptime(maxTime, "%Y-%m-%dT%H:%M:%S")
| eval timediffindays = (outtime - intime)/86400
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Sep 2019 20:02:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Calculate-difference-between-2-timestamps-in-days/m-p/485145#M83044</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-09-23T20:02:25Z</dc:date>
    </item>
  </channel>
</rss>

