JIRA JQL searching by date - is there a way of getting Today() (Date) instead of Now() (DateTime)

DateSearchJiraJql

Date Problem Overview


I am trying to create some Issue Filters in JIRA based on CreateDate.

The only date/time function I can find is Now() and searches relative to that, i.e. "-1d", "-4d" etc.

The only problem with this is that Now() is time specific so there is no way of getting a particular day's created issues.

i.e. Created < Now() AND Created >= "-1d"

when run at 2pm today will show all issues created from 2pm yesterday to 2pm today
when run at 9am tomorrow will show all issues created from 9am today to 9am tomorrow

What I want is to be able to search for all issues created from 00:00 to 23:59 on any day. Is this possible?

Date Solutions


Solution 1 - Date

Check out startOfDay([offset]). That gets what you are looking for without the pesky time constraints and its built in as of 4.3.x. It also has variants like endOfDay, startOfWeek, startOfMonth, etc.

Solution 2 - Date

I run it like this -

created > startOfDay(-0d)

It gives me all issues created today. When you change -0d to -1d, it will give you all issues created yesterday and today.

Solution 3 - Date

We're using Jira 6.2 and I use this query:

> updatedDate > startOfDay(-1d) AND updatedDate < endOfDay(-1)

to return all of the issues that were updated from the previous day. You can combine with whichever queries you want to return the appropriate issues for the previous day.

Solution 4 - Date

In case you want to search for all the issues updated after 9am previous day until today at 9AM, please try: updated >= startOfDay(-15h) and updated <= startOfDay(9h). (explanation: 9AM - 24h/day = -15h)

You can also use updated >= startOfDay(-900m) . where 900m = 15h*60m

Reference: https://confluence.atlassian.com/display/JIRA/Advanced+Searching

Solution 5 - Date

A friend who is a JIRA wiz showed me that you can actually pass the filter (escaped) as a jqlQuery parameter to JIRA via URL:

http://hostname/secure/IssueNavigator!executeAdvanced.jspa?clear=true&runQuery=true&jqlQuery=created%3E='2010-05-31%2000:00'%20AND%20created%3C='2010-06-06%2023:59'%20ORDER%20BY%20created%20ASC

I created an ASP.Net page which generates the URLs based on an offset week or month.

Everybody's happy!

Solution 6 - Date

Just for the sake of keeping the information up-to-date, with at least JIRA 7.3.0 (maybe older as well) you can explicitly specify the date in multiple formats:

  • 'yyyy/MM/dd HH:mm';
  • 'yyyy-MM-dd HH:mm';
  • 'yyyy/MM/dd';
  • 'yyyy-MM-dd';
  • period format, e.g. '-5d', '4w 2d'.

Example:

updatedDate > '2018/06/09 0:00' and updatedDate < '2018/06/10 15:00'

Solution 7 - Date

You would expect that this is easily possible but that seems not be the case. The only way I see at the moment is to create a user defined JQL function. I never tried this but here is a plug-in:

http://confluence.atlassian.com/display/DEVNET/Plugin+Tutorial+-+Adding+a+JQL+Function+to+JIRA

Solution 8 - Date

You might use one of our plugins: the JQL enhancement functions - check out https://plugins.atlassian.com/plugin/details/22514

There is no interval on day, but we might add it in a next iteration, if you think it is usefull.

Francis.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionShevekView Question on Stackoverflow
Solution 1 - DateRob AllenView Answer on Stackoverflow
Solution 2 - DateSteven van VeenendaalView Answer on Stackoverflow
Solution 3 - DateJohan LieuView Answer on Stackoverflow
Solution 4 - DateeliberatorView Answer on Stackoverflow
Solution 5 - DateShevekView Answer on Stackoverflow
Solution 6 - DateAlexander AmelkinView Answer on Stackoverflow
Solution 7 - DateStefan EgliView Answer on Stackoverflow
Solution 8 - DateFrancis MartensView Answer on Stackoverflow