<?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: help on date field sorting in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/help-on-date-field-sorting/m-p/548030#M155408</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/102660"&gt;@jip31&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You are loosing the dv_sys_created_on field on stats command, you can sort like below;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="tutu" sourcetype="toto" 
| stats last(dv_sys_created_on) as Opened by ticket_id 
| sort - Opened&lt;/LI-CODE&gt;&lt;P&gt;Or if date field is string below should work better; assuming your date format is&amp;nbsp;"%d-%m-%y %H:%M"&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="tutu" sourcetype="toto" 
| stats last(dv_sys_created_on) as Opened by ticket_id 
| eval time = strptime(Opened, "%d-%m-%y %H:%M")
| sort - time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Apr 2021 15:25:57 GMT</pubDate>
    <dc:creator>scelikok</dc:creator>
    <dc:date>2021-04-15T15:25:57Z</dc:date>
    <item>
      <title>help on date field sorting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-date-field-sorting/m-p/548024#M155405</link>
      <description>&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;the field&amp;nbsp;dv_sys_created_on is a field date&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="tutu" sourcetype="toto" 
| stats last(dv_sys_created_on) as Opened by ticket_id &lt;/LI-CODE&gt;&lt;P&gt;i tried to sort it like this but it doesnt works&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval time = strftime(dv_sys_created_on, "%d-%m-%y %H:%M")
| sort - dv_sys_created_on&lt;/LI-CODE&gt;&lt;P&gt;could you help please??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 15:08:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-date-field-sorting/m-p/548024#M155405</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2021-04-15T15:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: help on date field sorting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-date-field-sorting/m-p/548030#M155408</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/102660"&gt;@jip31&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You are loosing the dv_sys_created_on field on stats command, you can sort like below;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="tutu" sourcetype="toto" 
| stats last(dv_sys_created_on) as Opened by ticket_id 
| sort - Opened&lt;/LI-CODE&gt;&lt;P&gt;Or if date field is string below should work better; assuming your date format is&amp;nbsp;"%d-%m-%y %H:%M"&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="tutu" sourcetype="toto" 
| stats last(dv_sys_created_on) as Opened by ticket_id 
| eval time = strptime(Opened, "%d-%m-%y %H:%M")
| sort - time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 15:25:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-date-field-sorting/m-p/548030#M155408</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-04-15T15:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: help on date field sorting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-date-field-sorting/m-p/548031#M155409</link>
      <description>&lt;P&gt;What does "&lt;SPAN&gt;the field&amp;nbsp;dv_sys_created_on is a field date" mean? Is it a string in a particular format representing a date? If so, you need to parse the string (the p in strptime means parse, the f in strftime means format) into an epoch datetime (a number) which you can then sort on (strptime, string to number; strftime, number to string)&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval time = strptime(dv_sys_created_on, "%d-%m-%y %H:%M")
| sort - time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 15:30:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-date-field-sorting/m-p/548031#M155409</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-04-15T15:30:19Z</dc:date>
    </item>
  </channel>
</rss>

