Hi. I'm trying to setup a JQL query to setup 3 queries. One to get all issues created this January, one for January of last year, and one for January of 2 years ago.
The first one works:
project = "SomeProj" AND createdDate >= startOfYear("-0m") AND createdDate < endOfYear("-11m") ORDER BY createdDate ASC
I assumed I could just extend the month offsets like so to get 1 and 2 years back:
project = "SomeProj" AND createdDate >= startOfYear("-12m") AND createdDate < endOfYear("-23m") ORDER BY createdDate ASC
project = "SomeProj" AND createdDate >= startOfYear("-24m") AND createdDate < endOfYear("-35m") ORDER BY createdDate ASC
However, when I do this, it always seems to give me results for January of this year. It's like, if you go beyond 12 months, it "wraps" / doesn't inc/dec the year.
Anyone know if I'm missing something here or is this just the behavior of the functions? If it is the behavior, anyone have a clever solution for writing "dynamic" queries that are valid for a specified month of the trailing n years?
Thanks in advance.
Hello,
m means minutes not months. It is not possible to use months.
Hi @Alexey Matveev,
While you are right about that m is used to query minutes, you can use +-M to query for months.
You can see this in the documentation of the function:
I hope you don't mind me pointing this out.
With kind regards
Mario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for mentioning!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Alexey is correct that lowercase 'm' denotes minutes, but it IS possible to denote months, by using uppercase 'M'.
Also note that you can use dates if you find that easier, e.g.
created >= '2018-01-01' and created < '2018-02-01'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeah, that's what I was about to throw in the towel and do, then I realized m = minutes and M = months. I'd prefer to not have to rev this every year. Thanks though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Payne
Sealan and @morrist1
If you use dates be aware that they assume use as a default date time 12am. To really get all issues in the year you should go with:
Created >= '2018-01-01 00:00' AND Created <= '2019-01-01 00:00'
With kind regards
Mario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Right, Mario, but they are equivalent. Omitting a time assumes 00:00 as you point out, so no need to explicitly state it. One should be aware of that in choosing the end date, though, and add one day to it, e.g. created < '2018-02-01', since created <= '2018-01-31' would not include any issues from 1/31.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you test this?
12:00 as default would make sense too because it is exactly the middle of the day.
I got the information from this thread :
But I didn't tested it so maybe the information there is outdated or missinformed.
With kind regards
Mario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I have tested and confirmed that the default time, if none is specified, is 00:00 (midnight), not 12:00 (noon).
The accepted answer on the post you reference matches my explanation.
-Payne
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.