<?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: reformat date, timestamp in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/reformat-date-timestamp/m-p/43910#M8200</link>
    <description>&lt;P&gt;Does Splunk recognize this as a timestamp?  For my answer below, I will assume that Splunk extracted the date into the _time field.  An easy way to do this is to create a new field with eval:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yoursearchhere&amp;gt; | eval formattedTime = strftime(_time, "%D %r") | table formattedTime &amp;lt;otherfieldshere&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Once you have created the new field, you can use it however you like; I just supplied the table command as an example.  Google "strftime" for more formatting options.&lt;BR /&gt;
If the datetime is contained in a different field, substitute that field name for _time.  If Splunk didn't extract the field for you, post a bit more of the event (showing the timestamp in context) and someone will be able to help you extract it.&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jan 2012 16:10:46 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2012-01-04T16:10:46Z</dc:date>
    <item>
      <title>reformat date, timestamp</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/reformat-date-timestamp/m-p/43909#M8199</link>
      <description>&lt;P&gt;I am trying to reformat a date/time stamp field from within my output.&lt;/P&gt;

&lt;P&gt;Here is the current format: 21:32:31-Dec 08 2011&lt;/P&gt;

&lt;P&gt;New format: 12/08/2011 21:32:31 AM/PM&lt;/P&gt;

&lt;P&gt;thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2012 15:38:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/reformat-date-timestamp/m-p/43909#M8199</guid>
      <dc:creator>efelder0</dc:creator>
      <dc:date>2012-01-04T15:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: reformat date, timestamp</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/reformat-date-timestamp/m-p/43910#M8200</link>
      <description>&lt;P&gt;Does Splunk recognize this as a timestamp?  For my answer below, I will assume that Splunk extracted the date into the _time field.  An easy way to do this is to create a new field with eval:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yoursearchhere&amp;gt; | eval formattedTime = strftime(_time, "%D %r") | table formattedTime &amp;lt;otherfieldshere&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Once you have created the new field, you can use it however you like; I just supplied the table command as an example.  Google "strftime" for more formatting options.&lt;BR /&gt;
If the datetime is contained in a different field, substitute that field name for _time.  If Splunk didn't extract the field for you, post a bit more of the event (showing the timestamp in context) and someone will be able to help you extract it.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2012 16:10:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/reformat-date-timestamp/m-p/43910#M8200</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-01-04T16:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: reformat date, timestamp</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/reformat-date-timestamp/m-p/43911#M8201</link>
      <description>&lt;P&gt;Convert it to an intermediate &lt;CODE&gt;time_t&lt;/CODE&gt; and back again, using &lt;CODE&gt;eval's&lt;/CODE&gt; &lt;CODE&gt;strptime&lt;/CODE&gt; and &lt;CODE&gt;strftime&lt;/CODE&gt; functions.  Something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;blah blah blah | eval myfield=strftime(strptime(myfield,"%H:%M:S-%b %d %Y"),"%M/%D/%Y %I:%M:%S %P"))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Jan 2012 16:11:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/reformat-date-timestamp/m-p/43911#M8201</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2012-01-04T16:11:25Z</dc:date>
    </item>
  </channel>
</rss>

