JQL: How to get day from date?

Natalia Vladimirova November 14, 2015

Hi,

Is there a way I can get day from date in JQL? I need something like DAY (<date>) or DATEPART (day, <date>) in T-SQL.

2 answers

1 accepted

1 vote
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 14, 2015

JQL is for finding issues, not working with the results.  All you really get from a JQL search is a list of issues. 

You then push that through some reporting (the issue navigator, reports, gadgets etc), and the reporting is what determines the output. 

So, you'd need to do that in the report, not JQL.  So the next question is "where do you want to see this data?"

(Although, there's a 95% chance that the answer is going to be "you need a scripted field", I should ask just in case it's not)

Natalia Vladimirova November 15, 2015

Hi, Nic, Thank you for your reply. I know that JQL queries return issues as results. I'd like to use day number in query to get a list of issues which were for instance created on a certain day, regardless of month or year. Or updated, or something. I'm not sure if I managed to explain but I do hope it makes sense.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 15, 2015

Right, you'll need something that can extract that. It's a JQL function or a scripted field to pull that out so you can search on it.

Natalia Vladimirova November 15, 2015

Just to make sure - you mean custom dev, right?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 15, 2015

Yes.

Natalia Vladimirova November 16, 2015

Aha, I see. Thanks.

0 votes
Patrick S
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 10, 2018

Found this post when having the same issue.  The root problem of comparison between dueDate and resolutionDate/resolved is that dueDate is a date and resolutionDate is a dateTime. It's a bit hackish, but we overcame it with the following JQL (ScriptRunner required).

duedate is not EMPTY AND (issueFunction in dateCompare("assignee in membersOf('myTeam')", "resolved < dueDate + 1439m"))

The downside of this approach is that you lose track of issues that were closed in the 23:59:00 minute, and there is no s <seconds> datepart available in JQL.

Suggest an answer

Log in or Sign up to answer