JQL - get current month automatically

Dana.Harel November 28, 2022

Hi, 

I'm building automation that will create each month a new issue. 

I would like for the issue's summary to contain the name of the current month we are in. 

How can I do it using JQL? 

Thanks

3 answers

2 accepted

1 vote
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 28, 2022

Hi @Dana.Harel 

I am guessing your rule uses the scheduled trigger to create the new, monthly issue.

If so, please take a look at the date time functions for smart values, and the documentation on the format() function: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

With that, you may format the value of {{now}} to be the name of the current month.

Kind regards,
Bill

Dana.Harel November 29, 2022

Hi @Bill Sheboy thanks!

I am using the scheduled trigger to create new monthly issue.

My wish is that for each issue - the summary will contain the current month's name -
For example "Monthly task - December"

I tried using the documentation attached but it seems like all I can get is the full date.

I tried using:

  • {{issue.created.format("dd/MM/yyyy")}}
  • {{now.startOfMonth}}

Will you be able to advise?

Thanks

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 29, 2022

That link I provided shows the format() function, and a link out to the examples for the format strings.  Here is one to return the full month name for the current date:

{{now.format("MMMM")}}

Dana.Harel November 30, 2022

Thanks is worked!!

Like Bill Sheboy likes this
Avinaba Deb
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 29, 2024

{{now.format("MMMM")}} function gives you the month in string e.g. February. Is there any function that gives the month number like 02 instead of February?

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 1, 2024

Hi @Avinaba Deb -- Welcome to the Atlassian Community!

Yes, there is.  Please follow the documentation link above, and you will find information  for the different format expressions (via a link to the Java docs).

Kind regards,
Bill

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 28, 2022

JQL finds issues, not dates, so, no, you can't do this with JQL.  You'll need to write something that can get the month name as part of your "create" script/program

Dana.Harel November 28, 2022

Thanks - where should I write something like this?

0 votes
Dana.Harel November 28, 2022

Can I use "getMonth()" or one of - endOfWeek, endOfMonth, and endOfYear; and startOfDay, startOfWeek, startOfMonth, and startOfYear?

Suggest an answer

Log in or Sign up to answer