<?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 How do I convert a timestamp? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-a-timestamp/m-p/354297#M64795</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a field with timestamp value "2017-09-21T20:48:48.535427Z" in format. I need to convert it to "09/21/2017 3:48:48 PM", Please advise?&lt;/P&gt;</description>
    <pubDate>Thu, 21 Sep 2017 21:24:04 GMT</pubDate>
    <dc:creator>kiran331</dc:creator>
    <dc:date>2017-09-21T21:24:04Z</dc:date>
    <item>
      <title>How do I convert a timestamp?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-a-timestamp/m-p/354297#M64795</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a field with timestamp value "2017-09-21T20:48:48.535427Z" in format. I need to convert it to "09/21/2017 3:48:48 PM", Please advise?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 21:24:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-a-timestamp/m-p/354297#M64795</guid>
      <dc:creator>kiran331</dc:creator>
      <dc:date>2017-09-21T21:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a timestamp?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-a-timestamp/m-p/354298#M64796</link>
      <description>&lt;P&gt;@kiran331, you would also need to confirm as to what is your Time field name and whether it is epoch timestamp or string timestamp.&lt;/P&gt;

&lt;P&gt;If it is string time stamp i.e. the field &lt;CODE&gt;Time&lt;/CODE&gt; contains string time value as per your given example, then you need to first convert the same to epoch time using &lt;CODE&gt;strptime()&lt;/CODE&gt; and then use &lt;CODE&gt;strftime()&lt;/CODE&gt; to convert to the required format.&lt;/P&gt;

&lt;P&gt;If the &lt;CODE&gt;Time&lt;/CODE&gt; field contains epoch time then you would only require &lt;CODE&gt;strftime()&lt;/CODE&gt; to convert from epoch to string time as per your format. Following is run anywhere search as per your question. PS first two pipes are used to mock up &lt;CODE&gt;Time&lt;/CODE&gt; field with test value. You can replace the same with your search and time field name accordingly.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval Time="2017-09-21T20:48:48.535427Z"
| eval TimeStringConverted=strftime(strptime(Time,"%Y-%m-%dT%H:%M:%S.%6N"),"%m/%d/%Y %H:%M:%S %p")
| table Time TimeStringConverted
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Sep 2017 23:57:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-a-timestamp/m-p/354298#M64796</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-09-21T23:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a timestamp?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-a-timestamp/m-p/354299#M64797</link>
      <description>&lt;P&gt;Hey @kiran331, if they solved your problem, please don't forget to accept an answer! You can upvote posts as well. (Karma points will be awarded for either action.) Happy Splunking!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2017 00:17:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-a-timestamp/m-p/354299#M64797</guid>
      <dc:creator>lfedak_splunk</dc:creator>
      <dc:date>2017-09-22T00:17:14Z</dc:date>
    </item>
  </channel>
</rss>

