Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Filter by Month - Any Year

Jonathan Zschau February 6, 2019

Hello: 

I'm wondering what the query syntax would be to search custom date fields by month, regardless of year. For example, if we have two issues, one with a field value of "2019-02-01" and one with a value of "2016-02-08" both issues will be returned. 

My thought is an advanced search would look something like this (where ~ represents any year): 

CUSTOM_DATE_FIELD >= ~-02-01 AND CUSTOM_DATE_FIELD <= ~02-28 order by lastViewed DESC

 

Thanks in advance!

2 answers

0 votes
Jonathan Zschau February 6, 2019

At the end of the day all we need to be able to do is use a custom date field's values to filter issues by the month coded in the custom date field. So we may have 5 issues with varying dates in, say, January (i.e., January 2, 2020; January 13, 2020; January 16, 2021; January 19, 2021; & January 4, 2023) we want to be able to tailor a simple filter that will return all of those issues (i.e., the 5 listed above). 

We would like to avoid the manual process of coding both a custom date field and, say, a single value field with Jan, Feb, Mar, Apr, etc. values in them. 

Another option would be to manually increment the years on the custom date field so that the year on the date field is always looking forward to the next year, but that again would be a manual process we would like to avoid. 

0 votes
Payne
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 6, 2019

One idea, if you have the ScriptRunner add-on installed, is to use a Script Field with a script of 

issue.created.format("M")

which you could then use in JQL like

CUSTOM_DATE_FIELD_MONTH ~ 2 
Jonathan Zschau February 6, 2019

Thanks for the quick response Payne, that would do it, but we do not have ScriptRunner installed :-/.

Suggest an answer

Log in or Sign up to answer