The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

How to filter time windows with JQL

Gerardo Dalena
Contributor
July 14, 2021

Hello,

I'm struggling with a JQL query to filter results in several time windows. I need to filter some issues outside business hours, so:

  1. from Mon to Fri from 8:00 p.m. to 8:00 a.m.
  2. from Sat to Sun anytime

These are the query that I have deployed, but I'm missing something in the syntax because the result I have are inconsistent:

  1. (("Date and time TT Processing[Time stamp]" >= startOfDay()) and ("Date and time TT Processing[Time stamp]" <= startOfDay("+8h"))) OR (("Date and time TT Processing[Time stamp]" >= startOfDay("+20h")) and ("Date and time TT Processing[Time stamp]" <= startOfDay("+1d")))
  2. ("Date and time TT Processing[Time stamp]" >= startOfWeek("+6d")) OR ("Date and time TT Processing[Time stamp]" < startOfWeek("+8d"))

Can someone please tell me whaat I'm doing wrong?

Thanks.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Bill Sheboy
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 Champions.
July 14, 2021

Hi @Gerardo Dalena 

Those functions you are using from advanced JQL are relative to the current day.  They do not float as I believe you are expecting for any day.  I do not believe that is possible with out-of-the-box Jira Cloud's JQL.  There are marketplace scripting add-ons which could help.

For your weekly query, startOfWeek() is again relative to the current day, and weeks start on Sunday with 1.  So your >=+6 includes Friday and your +8 is in the future.  :^)  You could check last week by using  >= startOfWeek(-1d) to < startOfWeek(+1d)

Best regards,
Bill

Gerardo Dalena
Contributor
July 16, 2021

Hello @Bill Sheboy 

that's a good food for thought, thanks!

Best regards,

Like • Bill Sheboy likes this