I have to produce Jan-2017 Feb-2017 in the dropdown
search query |eval datetime = strftime(strptime(mydate,"%m/%d/%Y"),"%b-%Y")|dedup datetime|table datetime|sort - datetime
I get Feb and Jan which is sorted by alphabetical order. How to sort with month order. please help. Thanks!
You probably have to use the numerical format for the month to sort, and then add the text version afterward. Try this.
<search query>
| eval datetime_num = strftime(strptime(mydate,"%m/%d/%Y"),"%m-%Y")
| dedup datetime_num
| table mydate datetime_num
| sort - datetime_num
| eval datetime = strftime(strptime(mydate,"%m/%d/%Y"),"%b-%Y")
| fields datetime
You probably have to use the numerical format for the month to sort, and then add the text version afterward. Try this.
<search query>
| eval datetime_num = strftime(strptime(mydate,"%m/%d/%Y"),"%m-%Y")
| dedup datetime_num
| table mydate datetime_num
| sort - datetime_num
| eval datetime = strftime(strptime(mydate,"%m/%d/%Y"),"%b-%Y")
| fields datetime
Thanks a lot.. It worked!!