<?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: convert string date(without seprater) to readable date format -  20180112 to 12/01/2018 in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/convert-string-date-without-seprater-to-readable-date-format/m-p/331752#M98663</link>
    <description>&lt;P&gt;Try this anywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval Time="20180112"
| eval time=strftime(strptime(Time,"%Y%m%d"),"%d/%m/%Y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can create eval field expression in data model using  &lt;CODE&gt;| eval time=strftime(strptime(Time,"%Y%m%d"),"%d/%m/%Y")&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jan 2018 18:38:39 GMT</pubDate>
    <dc:creator>493669</dc:creator>
    <dc:date>2018-01-23T18:38:39Z</dc:date>
    <item>
      <title>convert string date(without seprater) to readable date format -  20180112 to 12/01/2018</title>
      <link>https://community.splunk.com/t5/Splunk-Search/convert-string-date-without-seprater-to-readable-date-format/m-p/331751#M98662</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I am using data-models. In raw data I am getting date as YYYYMMDD, I want to convert it in DD/MM/YYYY.&lt;/P&gt;

&lt;P&gt;Is there a simple way to convert this as there is no separator ?&lt;/P&gt;

&lt;P&gt;Otherwise I have to separate them in 3 different fields and use it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ^(?&amp;lt;year&amp;gt;\d\d\d\d)(?&amp;lt;month&amp;gt;\d\d)(?&amp;lt;day&amp;gt;\d\d)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Example :  20180112 to 12/01/2018 &lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 18:25:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/convert-string-date-without-seprater-to-readable-date-format/m-p/331751#M98662</guid>
      <dc:creator>goyals05</dc:creator>
      <dc:date>2018-01-23T18:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: convert string date(without seprater) to readable date format -  20180112 to 12/01/2018</title>
      <link>https://community.splunk.com/t5/Splunk-Search/convert-string-date-without-seprater-to-readable-date-format/m-p/331752#M98663</link>
      <description>&lt;P&gt;Try this anywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval Time="20180112"
| eval time=strftime(strptime(Time,"%Y%m%d"),"%d/%m/%Y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can create eval field expression in data model using  &lt;CODE&gt;| eval time=strftime(strptime(Time,"%Y%m%d"),"%d/%m/%Y")&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 18:38:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/convert-string-date-without-seprater-to-readable-date-format/m-p/331752#M98663</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-01-23T18:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: convert string date(without seprater) to readable date format -  20180112 to 12/01/2018</title>
      <link>https://community.splunk.com/t5/Splunk-Search/convert-string-date-without-seprater-to-readable-date-format/m-p/331753#M98664</link>
      <description>&lt;P&gt;Try this run anywhere search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval date="20180112 20180130 20180131 20181212 20181231" 
| makemv date 
| mvexpand date 
| eval date=strftime(strptime(date,"%Y%m%d"),"%d/%m/%Y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In your environment you should write,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your_base_Search&amp;gt;
| eval date=strftime(strptime(date,"%Y%m%d"),"%d/%m/%Y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The inner &lt;CODE&gt;date&lt;/CODE&gt; is the field which have &lt;CODE&gt;YYYYMMDD&lt;/CODE&gt; format.&lt;BR /&gt;
let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 09:21:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/convert-string-date-without-seprater-to-readable-date-format/m-p/331753#M98664</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-24T09:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: convert string date(without seprater) to readable date format -  20180112 to 12/01/2018</title>
      <link>https://community.splunk.com/t5/Splunk-Search/convert-string-date-without-seprater-to-readable-date-format/m-p/331754#M98665</link>
      <description>&lt;P&gt;this will not work if you have &lt;CODE&gt;Time="20180125"&lt;/CODE&gt; as the format is &lt;CODE&gt;DD/MM/YYYY&lt;/CODE&gt; and not &lt;CODE&gt;MM/DD/YYYY&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 09:25:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/convert-string-date-without-seprater-to-readable-date-format/m-p/331754#M98665</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-24T09:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: convert string date(without seprater) to readable date format -  20180112 to 12/01/2018</title>
      <link>https://community.splunk.com/t5/Splunk-Search/convert-string-date-without-seprater-to-readable-date-format/m-p/331755#M98666</link>
      <description>&lt;P&gt;Thanks for correction! ☺ &lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 09:40:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/convert-string-date-without-seprater-to-readable-date-format/m-p/331755#M98666</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-01-24T09:40:11Z</dc:date>
    </item>
  </channel>
</rss>

