<?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: Time format &amp;amp; Duration Calc in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Time-format-amp-Duration-Calc/m-p/570703#M198881</link>
    <description>&lt;P&gt;Thank you Karma! This was exactly what I needed, appreciate your help&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Oct 2021 05:30:26 GMT</pubDate>
    <dc:creator>zoebanning</dc:creator>
    <dc:date>2021-10-13T05:30:26Z</dc:date>
    <item>
      <title>Time format &amp; Duration Calc</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-format-amp-Duration-Calc/m-p/570696#M198878</link>
      <description>&lt;P&gt;Hello Splunk Community,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me build a query based on the below;&lt;/P&gt;&lt;P&gt;I want to convert a field (&lt;SPAN&gt;Fri Oct 8 23:15:05 AEDT 2021)&amp;nbsp;&lt;/SPAN&gt;into time format &amp;amp; then calculate the duration by subtracting the end time by the start time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate your help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 02:52:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-format-amp-Duration-Calc/m-p/570696#M198878</guid>
      <dc:creator>zoebanning</dc:creator>
      <dc:date>2021-10-13T02:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Time format &amp; Duration Calc</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-format-amp-Duration-Calc/m-p/570701#M198880</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/239620"&gt;@zoebanning&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can achieve this by using &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.2/SearchReference/DateandTimeFunctions#strptime.28X.2CY.29" target="_self"&gt;strptime&lt;/A&gt; function and &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.2/SearchReference/ConversionFunctions#tostring.28X.2CY.29" target="_self"&gt;tostring&lt;/A&gt; function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="php"&gt;YOUR_SEARCH
|eval start_epoch=strptime(start_time,"%a %b %d %H:%M:%S %Z %Y"),end_epoch=strptime(end_time,"%a %b %d %H:%M:%S %Z %Y"), diff_in_sec=end_epoch-start_epoch,duration=tostring(diff_in_sec,"duration")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My Sample Search :&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval start_time="Fri Oct 8 23:15:05 AEDT 2021",end_time="Fri Oct 8 23:20:05 AEDT 2021"
|eval start_epoch=strptime(start_time,"%a %b %d %H:%M:%S %Z %Y"),end_epoch=strptime(end_time,"%a %b %d %H:%M:%S %Z %Y"), diff_in_sec=end_epoch-start_epoch,duration=tostring(diff_in_sec,"duration")&lt;/LI-CODE&gt;&lt;P&gt;References:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.2/SearchReference/ConversionFunctions" target="_self"&gt;Conversion functions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.2/SearchReference/DateandTimeFunctions" target="_self"&gt;Date and Time functions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.2/SearchReference/Commontimeformatvariables" target="_self"&gt;Date and time format variables&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I hope this will help you.&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;▄︻̷̿┻̿═━一 &amp;nbsp; &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 05:00:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-format-amp-Duration-Calc/m-p/570701#M198880</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-10-13T05:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: Time format &amp; Duration Calc</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-format-amp-Duration-Calc/m-p/570703#M198881</link>
      <description>&lt;P&gt;Thank you Karma! This was exactly what I needed, appreciate your help&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 05:30:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-format-amp-Duration-Calc/m-p/570703#M198881</guid>
      <dc:creator>zoebanning</dc:creator>
      <dc:date>2021-10-13T05:30:26Z</dc:date>
    </item>
  </channel>
</rss>

