<?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 date field given in dd(numeric)-mmm(text)-yyyy(numeric) into mm/dd/yyyy in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Convert-date-field-given-in-dd-numeric-mmm-text-yyyy-numeric/m-p/380332#M168035</link>
    <description>&lt;P&gt;hello there,&lt;/P&gt;

&lt;P&gt;give this a shot:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | makeresults 
    | eval date = "17-Apr-2018,18-Apr-2018,1-Jan-2018"
    | makemv delim="," date
    | mvexpand date
    | eval to_epoch = strptime(date, "%d-%b-%Y")
    | eval to_desired_format = strftime(to_epoch, "%m/%d/%Y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;hope it helps&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jul 2018 00:39:43 GMT</pubDate>
    <dc:creator>adonio</dc:creator>
    <dc:date>2018-07-31T00:39:43Z</dc:date>
    <item>
      <title>Convert date field given in dd(numeric)-mmm(text)-yyyy(numeric) into mm/dd/yyyy</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-date-field-given-in-dd-numeric-mmm-text-yyyy-numeric/m-p/380331#M168034</link>
      <description>&lt;P&gt;Hi &lt;BR /&gt;
In one of my log reports a date field (not the deafult _time field) has data as 06-Mar-2018 and not as 03/06/2018.&lt;BR /&gt;
Can anyone suggest a simple approach to do this conversion.&lt;BR /&gt;
RIght now my thought process is as below:&lt;BR /&gt;
    | makeresults &lt;BR /&gt;
    | eval date = "17-Apr-2018"&lt;BR /&gt;
    |eval splitted=split(date, "-")&lt;BR /&gt;
    |table splitted| eval day = mvindex(splitted, 0)&lt;BR /&gt;
      | eval month_text = mvindex(splitted, 1)&lt;BR /&gt;
      | eval year = mvindex(splitted, 2)&lt;BR /&gt;
      | eval month=case( like(month_text,"Jan") OR like(month_text,"jan"),01, like(month_text,"Feb") OR like(month_text,"feb"),02,like(month_text,"Mar") OR like(month_text,"mar&lt;BR /&gt;
      "),03,like(month_text,"Apr") OR like(month_text,"apr"),04,like(month_text,"May") OR like(month_text,"may"),05,like(month_text,"Jun") OR like(month_text,"jun"),06,&lt;BR /&gt;
      like(month_text,"Jul") OR like(month_text,"jul"),07,like(month_text,"Aug") OR like(month_text,"aug"),08,like(month_text,"Sep") OR like(month_text,"sep"),09,&lt;BR /&gt;
      like(month_text,"Oct") OR like(month_text,"oct"),10,like(month_text,"Nov") OR like(month_text,"nov"),11,like(month_text,"Dec") OR like(month_text,"dec"),12)&lt;BR /&gt;
      |eval date_dt= +toString(month)+"/"+toString(day)+"/"+toString(year)| fields - splitted month_text&lt;/P&gt;

&lt;P&gt;Please suggest&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:41:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-date-field-given-in-dd-numeric-mmm-text-yyyy-numeric/m-p/380331#M168034</guid>
      <dc:creator>vikfnu</dc:creator>
      <dc:date>2020-09-29T20:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: Convert date field given in dd(numeric)-mmm(text)-yyyy(numeric) into mm/dd/yyyy</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-date-field-given-in-dd-numeric-mmm-text-yyyy-numeric/m-p/380332#M168035</link>
      <description>&lt;P&gt;hello there,&lt;/P&gt;

&lt;P&gt;give this a shot:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | makeresults 
    | eval date = "17-Apr-2018,18-Apr-2018,1-Jan-2018"
    | makemv delim="," date
    | mvexpand date
    | eval to_epoch = strptime(date, "%d-%b-%Y")
    | eval to_desired_format = strftime(to_epoch, "%m/%d/%Y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;hope it helps&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 00:39:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-date-field-given-in-dd-numeric-mmm-text-yyyy-numeric/m-p/380332#M168035</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-07-31T00:39:43Z</dc:date>
    </item>
  </channel>
</rss>

