<?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 find the difference between 2 times in date time format? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-find-the-difference-between-2-times-in-date-time-format/m-p/197593#M39249</link>
    <description>&lt;P&gt;Excellent,Thanks Tom&lt;/P&gt;</description>
    <pubDate>Fri, 29 Aug 2014 01:15:37 GMT</pubDate>
    <dc:creator>karthikTIL</dc:creator>
    <dc:date>2014-08-29T01:15:37Z</dc:date>
    <item>
      <title>How to find the difference between 2 times in date time format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-find-the-difference-between-2-times-in-date-time-format/m-p/197589#M39245</link>
      <description>&lt;P&gt;HI, I have two fields A and B with time format as 1/07/2014 3:41:12 PM.&lt;BR /&gt;
Please let me know how to find difference between A and B in hours with this format?&lt;/P&gt;

&lt;P&gt;e.g., if A is 1/07/2014 3:41:12 PM  and B is 2/07/2014 2:41:12 PM, B-A should be 23 hours&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2014 07:12:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-find-the-difference-between-2-times-in-date-time-format/m-p/197589#M39245</guid>
      <dc:creator>karthikTIL</dc:creator>
      <dc:date>2014-08-28T07:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between 2 times in date time format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-find-the-difference-between-2-times-in-date-time-format/m-p/197590#M39246</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;you could convert your two timestamps to epoch time, which is then seconds. Then you can calculate the difference between your timestamps in seconds (your B-A). After this you divide the result by 3600 which is an hour in seconds. If you want, you can then round to a full hour or whatever you like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval epoch_A=strptime(A,"%d/%m/%Y %I:%M:%S %p") | eval epoch_B=strptime(B,"%d/%m/%Y %I:%M:%S %p") | eval diff=round(('epoch_B'-'epoch_A') / 3600)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Aug 2014 07:53:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-find-the-difference-between-2-times-in-date-time-format/m-p/197590#M39246</guid>
      <dc:creator>tom_frotscher</dc:creator>
      <dc:date>2014-08-28T07:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between 2 times in date time format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-find-the-difference-between-2-times-in-date-time-format/m-p/197591#M39247</link>
      <description>&lt;P&gt;I dont find output when i mention this&lt;BR /&gt;
"eval epoch_A=strptime("Assigned_TIME","%d/%m/%Y %I:%M:%S %p") | eval epoch_B=strptime("In Progress_TIME","%d/%m/%Y %I:%M:%S %p") | eval diff=round(('epoch_B'-'epoch_A') / 3600)|table diff"&lt;/P&gt;

&lt;P&gt;fyi., A is Assigned_Time and B is In Progress_Time&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:25:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-find-the-difference-between-2-times-in-date-time-format/m-p/197591#M39247</guid>
      <dc:creator>karthikTIL</dc:creator>
      <dc:date>2020-09-28T17:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between 2 times in date time format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-find-the-difference-between-2-times-in-date-time-format/m-p/197592#M39248</link>
      <description>&lt;P&gt;Try to replace the " with ' symbols for the first argument in the strptime function. Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"eval epoch_A=strptime('Assigned_TIME',"%d/%m/%Y %I:%M:%S %p") | eval epoch_B=strptime('In Progress_TIME',"%d/%m/%Y %I:%M:%S %p") | eval diff=round(('epoch_B'-'epoch_A') / 3600)|table diff"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Aug 2014 08:05:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-find-the-difference-between-2-times-in-date-time-format/m-p/197592#M39248</guid>
      <dc:creator>tom_frotscher</dc:creator>
      <dc:date>2014-08-28T08:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between 2 times in date time format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-find-the-difference-between-2-times-in-date-time-format/m-p/197593#M39249</link>
      <description>&lt;P&gt;Excellent,Thanks Tom&lt;/P&gt;</description>
      <pubDate>Fri, 29 Aug 2014 01:15:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-find-the-difference-between-2-times-in-date-time-format/m-p/197593#M39249</guid>
      <dc:creator>karthikTIL</dc:creator>
      <dc:date>2014-08-29T01:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between 2 times in date time format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-find-the-difference-between-2-times-in-date-time-format/m-p/197594#M39250</link>
      <description>&lt;P&gt;HI, is there a way in splunk to get the difference only on the business hours i.e., from 9AM to 5PM and excluding saturday,sunday,public holidays?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Sep 2014 03:59:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-find-the-difference-between-2-times-in-date-time-format/m-p/197594#M39250</guid>
      <dc:creator>karthikTIL</dc:creator>
      <dc:date>2014-09-09T03:59:59Z</dc:date>
    </item>
  </channel>
</rss>

