Forums

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

Date/Time custom field with unexpected behavior in JQL

Durell Demartini
Contributor
January 4, 2024

Hello,

We have a custom field of type Date/Time called "Planned Start Date." I'm trying to write a JQL statement that will include all issues that meet the criteria of having a "Planned Start Date" that will occur within the next 2 hours. When I start from a Basic search, select the custom field and select "Within the last 2 hours," the Advanced JQL looks like this: "Planned Start Date" >= -2h 

However, the JQL is also including issues that have a Planned Start Date beyond the next two hours as well as including issues where the Planned Start Date has already passed. Is there a more precise way to write the JQL? 

Thanks in advance for your assistance.

1 answer

1 accepted

1 vote
Answer accepted
Trudy Claspill
Community Champion
January 4, 2024

Hello @Durell Demartini 

This statement:

"Planned Start Date" >= -2h 

...is interpreted as "give me any issue where the Planned Start Date is later than 2 hours before now.

If "now" is 2024-01-04 16:00 then issues will be included if their Planned Start Date is in the future with regard to that date time. That means they have a Planned Start Date of any time after 14:00 2024-01-04, including items that have a Planned Start Date later than now (i.e. 18:00 2024-01-04, or any time on any future date after today).

If you want the items that have a Planned Start Date within only the past 2 hours then you need this

"Planned Start Date" >= -2h  and "Planned Start Date <= now()

Durell Demartini
Contributor
January 5, 2024

Hi @Trudy Claspill thank you for the input. I tried your exact suggestion, and for some reason it didn't quite work as expected. However, I modified it a bit and it works exactly as we expect when I use this:  "Planned Start Date" >= now() AND "Planned Start Date" <= 2h

Thanks very much :)

Trudy Claspill
Community Champion
January 5, 2024

Your modification would give you all issues due within the next two hours.

The option you posted about in your message was finding the issues "Within the last 2 hours", which means the two hours before now. My solution matches that scenario.

Like • Durell Demartini likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
atlassian, atlassian community, loom ai, atlassian loom ai, loom, atlassian ai, record recaps of meetings, meeting recaps, loom recaps, share meeting recaps,

Loom’s guide to great meetings 📹

Join us to learn how your team can stay fully engaged in meetings without worrying about writing everything down. Dive into Loom's newest feature, Loom AI for meetings, which automatically takes notes and tracks action items.

Register today!
AUG Leaders

Atlassian Community Events