JQL for issues created between 15:00 (today) and 07:00 (next day)

Drishti Maharaj
Contributor
December 17, 2024

Hi,

I am trying to create a JQL for tickets created from 15:00 today till 07:00 the next morning and it might be the December mode but what does the 15h mean in the JQL?

Does that refer to the time (15:00) or 15 hours added to the start of day time?

"created >= startOfDay(15h) AND created <= startOfDay(7h)"

Thank you.

2 answers

1 accepted

4 votes
Answer accepted
Walter Buggenhout
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 17, 2024

Hi @Drishti Maharaj,

The number of hours between the parentheses is the number of hours you add to (or substract from) the start of today (0:00 this morning)

Your query - as you describe it in your title - does not make much sense, as issues can't have a created day that's in the future. It would be more logical if your plan is to search for issues that were created between 15:00 yesterday and 7:00 this morning.

That would be possible with the following statement:

created >= startOfDay(-9h) AND created <= startOfDay(7h)

where you count back 9 hours from midnight this morning and add 7 hours to midnight today.

Hope this helps!

Drishti Maharaj
Contributor
December 17, 2024

Hi @Walter Buggenhout - this works lol thank you so much.

My brain is clearly in December mode but reading yours, would definitely work for the purpose that I was trying to achieve.

That JQL works when I tried it now on the query.

Thanks once again!

Like Laurie Sciutti likes this
0 votes
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 17, 2024

Hi @Drishti Maharaj , the 15h is an offset from the startofday(). Since startofday() = 00:00 then in this case 15h does equate to 3pm or 15:00. With that said, your JQL doesn't really make sense. You can't find issue that will be created in the future. As written the JQL is effectively the same as created >= startOfDay(15h). So what is returned depends on when the query is run. If you run before 3pm nothing is returned. If run at 7pm then you will get issue created between 3pm and 7pm.

if you can further explain your goal I may be able to assist further. 

cheers!

Drishti Maharaj
Contributor
December 17, 2024

Hi @Jack Brickey - thank you for getting back to me.

So essentially they want that any tickets when created, and if they were created between 15:00 today and 07:00 tomorrow morning (standby times), then those specific tickets should be assigned to a particular user.

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 17, 2024

Actually, looking at your JQL it is more flawed than I initially stated. The results would always be empty. It is asking for issues created after 3pm AND before 7am so they contradict.

Drishti Maharaj
Contributor
December 17, 2024

I think the 7am might be the issue...I think perhaps startofday was not right as it should be for the next day?

Not too sure if that is even possible.

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 17, 2024

if you want to assign issue to a specific person when created between 3pm and 7am then create an automation rule like this...

  • trigger = issue created
  • condition = JQL - created >= startOfDay(15h) OR created <= startOfDay(7h)
  • action - assign issue

Suggest an answer

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

Atlassian Community Events