JQL for After Hours and Weekends

Rainy Hausen April 3, 2023

How do I write JQL to reflect tickets that were created on weekends and after 5pm on weekdays for certain Issue types? 

2 answers

1 accepted

2 votes
Answer accepted
Riley Venable
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 3, 2023
To write JQL to reflect tickets that were created on weekends and after 5pm on weekdays for certain Issue types, you can use the following query: ``` createdDate >= startOfWeek(-1d) and ( (createdDate >= startOfDay() + 17h or createdDate < startOfDay() + 8h) and issueType in (issueType1, issueType2, issueType3) ) ``` This query searches for issues that were created after 5pm on weekdays and on weekends for the specified issue types.

The `createdDate` field is compared to the start of the current week minus one day (`startOfWeek(-1d)`) to include the entire previous weekend. It then checks if the issue was created after 5pm (`createdDate >= startOfDay() + 17h`) or before 8am (`createdDate < startOfDay() + 8h`) on weekdays.

Finally, it filters by the specified issue types using the `issueType in (issueType1, issueType2, issueType3)` clause.

Note that `startOfDay()` and `startOfWeek()` are functions that return the start of the current day or week, respectively, and `17h` and `8h` specify the start times for the weekdays. You can adjust these values as needed to fit your specific requirements.
Rainy Hausen April 3, 2023

Thank you for your help. This is very informative and greatly appreciated!

Like Riley Venable likes this
Kirk Douglas July 12, 2023

How could I get all tickets created on the weekends since beginning of the year?

0 votes
Ash Yadav - VMotion IT Solutions
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 3, 2023

Hi @Rainy Hausen 

 

You can use the following for tickets that were created on the weekend: 

created > startOfWeek(-26h) AND created <= startOfWeek(1d) ORDER BY created DESC

 

Small edit: 

I just noticed @Riley Venable has provided a rather comprehensive answer so I'll leave the rest but I think you already have your answer with the below :) 

 

All the best, 

 

Ash 

Rainy Hausen April 3, 2023

Thank you for your help!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events