<?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 convert epoch to H:M:S? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373615#M109866</link>
    <description>&lt;P&gt;thanks @xpac! This work for me as well but I didn't use the |make results &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 02 May 2018 23:32:01 GMT</pubDate>
    <dc:creator>auaave</dc:creator>
    <dc:date>2018-05-02T23:32:01Z</dc:date>
    <item>
      <title>How to convert epoch to H:M:S?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373609#M109860</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;

&lt;P&gt;I have the below time formats that I converted to epoch to get the difference. &lt;BR /&gt;
START - "04-30-2018 16:17:09"&lt;BR /&gt;
END - "2018-04-30 16:17:19.072"&lt;/P&gt;

&lt;P&gt;I used the below query but the difference/ duration doesn't display properly. It displays 10:00:10 instead of 00:00:10, 10:10:10 instead of 00:10:10. How can I fix this? Thanks!&lt;/P&gt;

&lt;P&gt;| eval end=strptime(END,"%Y-%m-%d %H:%M:%S") |eval start=strptime(START,"%m-%d-%Y %H:%M:%S") |eval DURATION=(end-start) |table  start end DURATION | eval DURATION=strftime(DURATION, "%H:%M:%S")&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 13:20:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373609#M109860</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-05-02T13:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert epoch to H:M:S?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373610#M109861</link>
      <description>&lt;P&gt;Can you try :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval end=strptime(END,"%Y-%m-%d %H:%M:%S") |eval start=strptime(START,"%m-%d-%Y %H:%M:%S") |eval DURATION=(end-start) |table start end DURATION | eval DURATION=tostring(DURATION, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 May 2018 13:27:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373610#M109861</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-05-02T13:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert epoch to H:M:S?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373611#M109862</link>
      <description>&lt;P&gt;You should do the &lt;CODE&gt;DURATION&lt;/CODE&gt; math before converting to string format time.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval DURATION=('end'-'start') 
| eval DURATION=strftime(DURATION, "%H:%M:%S")
|table start end DURATION 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 May 2018 13:29:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373611#M109862</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-05-02T13:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert epoch to H:M:S?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373612#M109863</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;

&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval START="04-30-2018 16:17:09"
| eval END="2018-04-30 16:17:19.072" 
| eval end=strptime(END,"%Y-%m-%d %H:%M:%S") 
| eval start=strptime(START,"%m-%d-%Y %H:%M:%S") 
| eval DURATION=(end-start) 
| table start end DURATION
| fieldformat DURATION=tostring(DURATION, "duration")
| eval DURATION=replace(DURATION, "\.000000", "")
&lt;/CODE&gt;&lt;/PRE&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>Wed, 02 May 2018 13:35:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373612#M109863</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-05-02T13:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert epoch to H:M:S?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373613#M109864</link>
      <description>&lt;P&gt;Thank you @ p_gurav! This works for me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 23:29:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373613#M109864</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-05-02T23:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert epoch to H:M:S?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373614#M109865</link>
      <description>&lt;P&gt;Thanks @skoelpin, I tried this but still got the 10: in front. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 23:30:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373614#M109865</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-05-02T23:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert epoch to H:M:S?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373615#M109866</link>
      <description>&lt;P&gt;thanks @xpac! This work for me as well but I didn't use the |make results &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 23:32:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373615#M109866</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-05-02T23:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert epoch to H:M:S?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373616#M109867</link>
      <description>&lt;P&gt;The &lt;CODE&gt;makeresults&lt;/CODE&gt; part is only used to create fake events because we don't have your data available &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;
Happy it worked out for you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 00:10:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-epoch-to-H-M-S/m-p/373616#M109867</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-05-03T00:10:11Z</dc:date>
    </item>
  </channel>
</rss>

