<?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 do I convert the date format in a custom field? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-the-date-format-in-a-custom-field/m-p/400260#M71288</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try this &lt;/P&gt;

&lt;P&gt;| eval new_time = strftime(yourtimefield, "%d %b %Y")&lt;/P&gt;</description>
    <pubDate>Mon, 18 Feb 2019 17:59:32 GMT</pubDate>
    <dc:creator>PowerPacked</dc:creator>
    <dc:date>2019-02-18T17:59:32Z</dc:date>
    <item>
      <title>How do I convert the date format in a custom field?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-the-date-format-in-a-custom-field/m-p/400259#M71287</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I'm new here. I want to convert the format from "Thu Jan 31 23:01:13 CET 2019" to "31 Jan 2019" in a custom date field. &lt;/P&gt;

&lt;P&gt;How can I do that?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 13:55:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-the-date-format-in-a-custom-field/m-p/400259#M71287</guid>
      <dc:creator>egt</dc:creator>
      <dc:date>2019-02-18T13:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert the date format in a custom field?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-the-date-format-in-a-custom-field/m-p/400260#M71288</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try this &lt;/P&gt;

&lt;P&gt;| eval new_time = strftime(yourtimefield, "%d %b %Y")&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 17:59:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-the-date-format-in-a-custom-field/m-p/400260#M71288</guid>
      <dc:creator>PowerPacked</dc:creator>
      <dc:date>2019-02-18T17:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert the date format in a custom field?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-the-date-format-in-a-custom-field/m-p/400261#M71289</link>
      <description>&lt;P&gt;Hi @egt&lt;/P&gt;

&lt;P&gt;Try like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval date="Thu Jan 31 23:01:13 CET 2019" 
| eval epoch = strptime(date,"%a %b %d %H:%M:%S %Z %Y") 
| eval new_date =strftime(epoch,"%d %b %Y")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Feb 2019 18:12:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-the-date-format-in-a-custom-field/m-p/400261#M71289</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-02-18T18:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert the date format in a custom field?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-the-date-format-in-a-custom-field/m-p/400262#M71290</link>
      <description>&lt;P&gt;Try this query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval time = strftime(strptime(existingTimeField, "%a %b %d %H:%M:%S %Z %Y"), "%d %b %Y") | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Feb 2019 18:19:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-the-date-format-in-a-custom-field/m-p/400262#M71290</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-02-18T18:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert the date format in a custom field?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-the-date-format-in-a-custom-field/m-p/400263#M71291</link>
      <description>&lt;P&gt;@egt If your time is in say variable x, then you need to use strptime to convert in time in seconds and then use strftime to convert it to format you need &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval y=strptime(x,"%a %b %d %H:%M:%S %Z %Y")|eval z= strftime(y,"%d %b %Y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See the example created using makeresults.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval x= "Thu Jan 31 23:01:13 CET 2019"| eval y=strptime(x,"%a %b %d %H:%M:%S %Z %Y")|eval z= strftime(y,"%d %b %Y")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Feb 2019 18:20:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-the-date-format-in-a-custom-field/m-p/400263#M71291</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2019-02-18T18:20:45Z</dc:date>
    </item>
  </channel>
</rss>

