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:Ā 

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Answer accepted
Trudy P 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 P 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 P 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
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events