I have below data:
I want to sort the date by month and year
Like July 2017
I am using eval strftime function but ouput is coming as
Can someone please help me to fix this.
How exactly are you using the strptime function?
Sorting dates accurately into chronological order requires that they be converted into integer form. Otherwise, the dates are sorted lexicographically.
... | eval sortby = strptime (Date, "%b %Y") | sort + sortby | fields - sortby | table ...
You need to parse the dates with strptime to get the equivalent epoch dates - this is a number. When you sort by this number the dates will be in the right order. You then convert them back to string format using strftime. If you do that with fieldformat, you don't change then value of the epoch date field, you just change how it is displayed. This may give you what you want.