<?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 Converting timestamp to date? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Converting-timestamp-to-date/m-p/159511#M32366</link>
    <description>&lt;P&gt;Hello Splunk Community&lt;/P&gt;

&lt;P&gt;I am trying to convert a timestamp, StartTime (current format: 2014-05-09T19:11:52.5165976Z) in my log file data to a simple DD-MON-YY formatting.  I have found a number of solutions in these forums, but I cannot seem to get it to work despite numerous attempts.&lt;/P&gt;

&lt;P&gt;My original search is:  &lt;STRONG&gt;sourcetype="logfile" Status="*" | chart dc(UserId) by StartTime | SORT  dc(UserId) desc&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I have tried implementing the following code:  &lt;STRONG&gt;strptime(StartTime, "%d-%b-%Y")&lt;/STRONG&gt; but this makes the Search fail.  I’ve also tried using the eval command, but still no results are returned.&lt;/P&gt;

&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;

&lt;P&gt;Thank you,&lt;/P&gt;

&lt;P&gt;Mike&lt;/P&gt;</description>
    <pubDate>Fri, 09 May 2014 21:03:19 GMT</pubDate>
    <dc:creator>MichaelCohen821</dc:creator>
    <dc:date>2014-05-09T21:03:19Z</dc:date>
    <item>
      <title>Converting timestamp to date?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Converting-timestamp-to-date/m-p/159511#M32366</link>
      <description>&lt;P&gt;Hello Splunk Community&lt;/P&gt;

&lt;P&gt;I am trying to convert a timestamp, StartTime (current format: 2014-05-09T19:11:52.5165976Z) in my log file data to a simple DD-MON-YY formatting.  I have found a number of solutions in these forums, but I cannot seem to get it to work despite numerous attempts.&lt;/P&gt;

&lt;P&gt;My original search is:  &lt;STRONG&gt;sourcetype="logfile" Status="*" | chart dc(UserId) by StartTime | SORT  dc(UserId) desc&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I have tried implementing the following code:  &lt;STRONG&gt;strptime(StartTime, "%d-%b-%Y")&lt;/STRONG&gt; but this makes the Search fail.  I’ve also tried using the eval command, but still no results are returned.&lt;/P&gt;

&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;

&lt;P&gt;Thank you,&lt;/P&gt;

&lt;P&gt;Mike&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2014 21:03:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Converting-timestamp-to-date/m-p/159511#M32366</guid>
      <dc:creator>MichaelCohen821</dc:creator>
      <dc:date>2014-05-09T21:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: Converting timestamp to date?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Converting-timestamp-to-date/m-p/159512#M32367</link>
      <description>&lt;P&gt;Hi Mike,&lt;BR /&gt;
The timeformat looks to be simple which splunk should have read it automatically which will mean Starttime=_time(default eventtime)&lt;/P&gt;

&lt;P&gt;if not you need a convertion before make it to your usable format. So it would go like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval StartTime=strptime(StartTime, "%Y-%m-%dT%H:%M:%S")|eval StartTime=strftime(StartTime,"%d-%b-%Y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;BR /&gt;
    |eval StartTime=strptime(StartTime, "%Y-%m-%dT%H:%M:%S")|convert timeformat="%d-%b-%Y" ctime(StartTime)&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2014 21:15:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Converting-timestamp-to-date/m-p/159512#M32367</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-05-09T21:15:40Z</dc:date>
    </item>
  </channel>
</rss>

