<?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 to convert Aug-16 which is in text to a date format such that I can sort? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223817#M65895</link>
    <description>&lt;P&gt;Try this I am assuming your date is coming in a field &lt;CODE&gt;myField&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yourQuery to return myField
| eval newTime="00:00:00 01-".myField
| eval monthYear=strptime(newTime,"%H:%M:%S %d-%b-%y") 
| fieldformat monthYear=strftime(monthYear, "%b-%y")
| table myField, monthYear 
| sort monthYear
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Try to replace last line &lt;CODE&gt;| sort monthYear&lt;/CODE&gt; with &lt;CODE&gt;| sort myField&lt;/CODE&gt; and see the difference.&lt;/P&gt;</description>
    <pubDate>Wed, 09 Nov 2016 04:37:42 GMT</pubDate>
    <dc:creator>gokadroid</dc:creator>
    <dc:date>2016-11-09T04:37:42Z</dc:date>
    <item>
      <title>How to convert Aug-16 which is in text to a date format such that I can sort?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223811#M65889</link>
      <description>&lt;P&gt;For example I have the below data as text:&lt;/P&gt;

&lt;P&gt;Aug-16&lt;BR /&gt;
Sep-16&lt;BR /&gt;
Oct-16&lt;BR /&gt;
Nov-16&lt;BR /&gt;
Feb-16&lt;/P&gt;

&lt;P&gt;When I sort it with Month, I wish to see:&lt;/P&gt;

&lt;P&gt;Feb-16&lt;BR /&gt;
Aug-16&lt;BR /&gt;
Sep-16&lt;BR /&gt;
Oct-16&lt;BR /&gt;
Nov-16&lt;/P&gt;

&lt;P&gt;Currently When I sort, it shows as&lt;/P&gt;

&lt;P&gt;Aug-16&lt;BR /&gt;
Feb-16&lt;BR /&gt;
Nov-16&lt;BR /&gt;
Oct-16&lt;BR /&gt;
Sep-16&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2016 01:13:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223811#M65889</guid>
      <dc:creator>ravitejaj</dc:creator>
      <dc:date>2016-11-09T01:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Aug-16 which is in text to a date format such that I can sort?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223812#M65890</link>
      <description>&lt;P&gt;How about converting for sorting?&lt;/P&gt;

&lt;P&gt;・・・|eval sort_field=strptime(text_date,"%b-%d")|sort sort_field|fields - sort_field&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:43:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223812#M65890</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2020-09-29T11:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Aug-16 which is in text to a date format such that I can sort?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223813#M65891</link>
      <description>&lt;P&gt;Hey Horishi,&lt;/P&gt;

&lt;P&gt;This is not working.. First of all strptime is not returning any data.&lt;/P&gt;

&lt;P&gt;eval text_date="Aug-16" | eval sort_field=strptime(text_date,"%b-%d")|sort sort_field|fields - sort_field | table sort_field&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:43:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223813#M65891</guid>
      <dc:creator>ravitejaj</dc:creator>
      <dc:date>2020-09-29T11:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Aug-16 which is in text to a date format such that I can sort?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223814#M65892</link>
      <description>&lt;P&gt;I am deleting the sort_field .&lt;/P&gt;

&lt;P&gt;|fields - sort_field | table sort_field&lt;BR /&gt;
↓&lt;BR /&gt;
| table sort_field&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:43:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223814#M65892</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2020-09-29T11:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Aug-16 which is in text to a date format such that I can sort?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223815#M65893</link>
      <description>&lt;P&gt;Still the Sort is not working..&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2016 04:24:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223815#M65893</guid>
      <dc:creator>ravitejaj</dc:creator>
      <dc:date>2016-11-09T04:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Aug-16 which is in text to a date format such that I can sort?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223816#M65894</link>
      <description>&lt;P&gt;eval a=strftime(strptime(Approval_Month,"%b-%d"), "%b-%y") | table a | sort a&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2016 04:30:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223816#M65894</guid>
      <dc:creator>ravitejaj</dc:creator>
      <dc:date>2016-11-09T04:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Aug-16 which is in text to a date format such that I can sort?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223817#M65895</link>
      <description>&lt;P&gt;Try this I am assuming your date is coming in a field &lt;CODE&gt;myField&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yourQuery to return myField
| eval newTime="00:00:00 01-".myField
| eval monthYear=strptime(newTime,"%H:%M:%S %d-%b-%y") 
| fieldformat monthYear=strftime(monthYear, "%b-%y")
| table myField, monthYear 
| sort monthYear
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Try to replace last line &lt;CODE&gt;| sort monthYear&lt;/CODE&gt; with &lt;CODE&gt;| sort myField&lt;/CODE&gt; and see the difference.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2016 04:37:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223817#M65895</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2016-11-09T04:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Aug-16 which is in text to a date format such that I can sort?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223818#M65896</link>
      <description>&lt;P&gt;I mistook the day and the year.&lt;/P&gt;

&lt;P&gt;eval a=strftime(strptime(Approval_Month,"%b-%d"), "%b-%y") | table a | sort a&lt;BR /&gt;
↓&lt;BR /&gt;
eval wk_Approval_Month="00:00:00:01-"+Approval_Month|eval a=strftime(strptime(wk_Approval_Month,"%H:%M:%S:%d-%b-%y"),"%Y-%m") | sort a&lt;/P&gt;

&lt;P&gt;※a=2016-08&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:43:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Aug-16-which-is-in-text-to-a-date-format-such/m-p/223818#M65896</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2020-09-29T11:43:32Z</dc:date>
    </item>
  </channel>
</rss>

