JIRA date range search not working as expected

When I use JQL below:

project = CLN AND (created >= 2017-08-01 AND created <= 2017-08-04) ORDER BY created DESC

Items with create dates on 2017-08-04 are not included in the search results as I expect they would since I used the <= operator.

 

However if I use more precision:

project = CLN AND created >= 2017-08-01 AND created <= "2017-08-04 23:59" ORDER BY created DESC

 

I do get the results I'm looking for. Any ideas why?

 

1 answer

1 accepted

1 vote
Alex Christensen Community Champion Aug 04, 2017

I believe the default timestamp if one is not provided is "00:00" - so, the first query is actually searching for issues that fill this criteria:

project = CLN AND (created >= "2017-08-01 00:00" AND created <= "2017-08-04 00:00") ORDER BY created DESC

The "Created" Date saves the timestamp when you create an issue, so the above query is going to show you everything created at or after midnight on Aug 1, and everything before or exactly at midnight on Aug 4.

Another approach would be to use tthis query so you don't have to worry about timestamps:

project = CLN AND (created >= 2017-08-01 AND created < 2017-08-05) ORDER BY created DESC

Thanks, that makes sense.

ps, your suggestion is what we ended up doing :).  One note, according to the documentation, "Note that if a time-component is not specified, midnight will be assumed."

https://confluence.atlassian.com/jiracoreserver072/advanced-searching-fields-reference-829092671.html#Advancedsearching-fieldsreference-CreatedCreatedDatecreatedDateCreated

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

73 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you