Forums

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

JQL date query with specific date

Alexander November 8, 2022

Problem:
I need a JQL query for a filter in structure, which shows the issues where the field "Finish Date" is in or between the current year and these issues shall be seen also in January of next year, so until "2023-01-31";

so i tried the following, but it gives me an error; i cannot compare now() with startOfYear("+1M") and i also cannot compare now() with a fixed date like "2023-01-31"

"Finish date" >= startOfYear() AND "Finish date" <= endOfYear() OR
"Finish date" >= startOfYear("-1") AND "Finish date" <= endOfYear("-1") AND now() <= startOfYear("+1M")

 anyone a solution for this?

Kind Regards,

Alex

2 answers

0 votes
David Sloane December 28, 2022

This is more straightforward than it looks, and yet not intuitive.

You can use dates in yyyy-mm-dd format with some date fields, but not with the calculated date fields like "startOfYear"

For example

created >= 2021-01-01
0 votes
Sebastian Krzewiński
Community Champion
November 8, 2022

Hi @Alexander 

 

 i cannot compare now() with startOfYear("+1M") and i also cannot compare now() with a fixed date like "2023-01-31"

reason is that now() is a function which replace value not a field. You cannot make JQL query like value - operator - value. You need to use field - operator - value.

In your case I think that you need to use this query: 

"Finish date" >= startOfYear("-1") AND "Finish date" <= "2023/01/31"

 

Regards,

Seba

Alexander November 8, 2022

Hi @Sebastian Krzewiński 

thanks for your answer;

unfortunately, your query is not what i want, i just want to see the issues from the current year and only when we are in January i also want to see the issues from last year;

with your query i see, now we are in November, also the issues from last year;

 

Regards,
Alex

Like njsoly likes this

Suggest an answer

Log in or Sign up to answer