<?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 Conversion into readble format in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-into-readble-format/m-p/347065#M164283</link>
    <description>&lt;P&gt;Thanks a lots. It worked. &lt;/P&gt;</description>
    <pubDate>Mon, 18 Dec 2017 04:27:38 GMT</pubDate>
    <dc:creator>ntalwar</dc:creator>
    <dc:date>2017-12-18T04:27:38Z</dc:date>
    <item>
      <title>Time Conversion into readble format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-into-readble-format/m-p/347061#M164279</link>
      <description>&lt;P&gt;Can someone help me converting 1513554224  into readable time format. I tried couple of formats but not working. I am using this search&lt;/P&gt;

&lt;P&gt;| stats count max(_time),min(_time) by user,dest | eval time = strftime (_time, "%m/%d/%y %H:%M:%S")&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:18:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-into-readble-format/m-p/347061#M164279</guid>
      <dc:creator>ntalwar</dc:creator>
      <dc:date>2020-09-29T17:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion into readble format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-into-readble-format/m-p/347062#M164280</link>
      <description>&lt;P&gt;| fieldformat time=strftime(_time, "%c") &lt;BR /&gt;
Try this.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 00:22:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-into-readble-format/m-p/347062#M164280</guid>
      <dc:creator>test_qweqwe</dc:creator>
      <dc:date>2017-12-18T00:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion into readble format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-into-readble-format/m-p/347063#M164281</link>
      <description>&lt;P&gt;Nothing changed. As before. Thanks anyways&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 02:09:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-into-readble-format/m-p/347063#M164281</guid>
      <dc:creator>ntalwar</dc:creator>
      <dc:date>2017-12-18T02:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion into readble format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-into-readble-format/m-p/347064#M164282</link>
      <description>&lt;P&gt;@ntalwar, once you use &lt;CODE&gt;max(_time)&lt;/CODE&gt; and &lt;CODE&gt;min(_time)&lt;/CODE&gt; within transforming command without aliasing to some other fieldname, you will have to use these in your subsequent Splunk search pipes. In your case field &lt;CODE&gt;_time&lt;/CODE&gt; is not available after stats command.&lt;/P&gt;

&lt;P&gt;You can try the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
| stats count max(_time),min(_time) by user,dest 
| fieldformat "latest(_time)" =strftime('latest(_time)',"%Y/%m/%d %H:%M:%S %p %z")
| fieldformat "earliest(_time)" =strftime('earliest(_time)',"%Y/%m/%d %H:%M:%S %p %z")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, it is better to rename fields after statistical function using &lt;CODE&gt;as&lt;/CODE&gt; to create alias. Following is what you can try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
| stats count latest(_time) as Last_Time, earliest(_time) as Earliest_Time by user,dest 
| fieldformat Last_Time =strftime(Last_Time,"%Y/%m/%d %H:%M:%S %p %z")
| fieldformat Earliest_Time =strftime(Earliest_Time,"%Y/%m/%d %H:%M:%S %p %z")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: While converting Epoch Time to String Time, I have used &lt;CODE&gt;YYYY/MM/DD HH:MM:SS AM/PM Timezone&lt;/CODE&gt; so that they keep lexical sorting even as a String time, but you can use a different format if that is a requirement.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;eval&lt;/CODE&gt; can also be used instead of &lt;CODE&gt;fieldformat&lt;/CODE&gt;, however, the difference as listed out in Splunk Documentation/Tutorials is that fieldformat will just apply the changes for display while retaining the original type of field i.e. epoch time. The &lt;CODE&gt;eval&lt;/CODE&gt; command on the other hand will override the underlying data type to string time as well.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 02:46:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-into-readble-format/m-p/347064#M164282</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-18T02:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Time Conversion into readble format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-into-readble-format/m-p/347065#M164283</link>
      <description>&lt;P&gt;Thanks a lots. It worked. &lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 04:27:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Time-Conversion-into-readble-format/m-p/347065#M164283</guid>
      <dc:creator>ntalwar</dc:creator>
      <dc:date>2017-12-18T04:27:38Z</dc:date>
    </item>
  </channel>
</rss>

