<?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: sorting date/time in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/sorting-date-time/m-p/360311#M5851</link>
    <description>&lt;P&gt;It works well, thanks you&lt;/P&gt;</description>
    <pubDate>Fri, 29 Sep 2017 01:23:55 GMT</pubDate>
    <dc:creator>SoknySplunk</dc:creator>
    <dc:date>2017-09-29T01:23:55Z</dc:date>
    <item>
      <title>sorting date/time</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/sorting-date-time/m-p/360309#M5849</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I have  example of date/time as below&lt;/P&gt;

&lt;P&gt;Mon 28 Dec 2015 06:26:19 PM ICT&lt;BR /&gt;
Mon 26 May 2014 04:52:02 PM ICT&lt;BR /&gt;
Fri 17 Feb 2017 04:01:59 PM ICT&lt;BR /&gt;
Wed 28 Jun 2017 05:49:04 PM ICT&lt;BR /&gt;
Wed 05 Oct 2016 06:46:30 PM ICT&lt;/P&gt;

&lt;P&gt;I want to sort it by date, month year... in the correct order. could you please tell me how to do it.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 02:31:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/sorting-date-time/m-p/360309#M5849</guid>
      <dc:creator>SoknySplunk</dc:creator>
      <dc:date>2017-09-28T02:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: sorting date/time</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/sorting-date-time/m-p/360310#M5850</link>
      <description>&lt;P&gt;You would have to convert the timestamp to epoch to sort it. &lt;/P&gt;

&lt;P&gt;Option 1 (creating a new field to sort)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search giving above field with name say DateTime
| eval sortfield=strptime(DateTime,"%a %d %b %Y %H:%M:%S %p %Z") 
| sort sortfield| field - sortfield
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Option 2 (using same field)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search giving above field with name say DateTime
| eval DateTime=strptime(DateTime,"%a %d %b %Y %H:%M:%S %p %Z") 
| sort DateTime| | eval DateTime=strftime(DateTime,"%a %d %b %Y %H:%M:%S %p %Z") 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Sep 2017 15:08:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/sorting-date-time/m-p/360310#M5850</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-09-28T15:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: sorting date/time</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/sorting-date-time/m-p/360311#M5851</link>
      <description>&lt;P&gt;It works well, thanks you&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2017 01:23:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/sorting-date-time/m-p/360311#M5851</guid>
      <dc:creator>SoknySplunk</dc:creator>
      <dc:date>2017-09-29T01:23:55Z</dc:date>
    </item>
  </channel>
</rss>

