How can I get the current week number of the month as Jira smart values?

jeoj September 27, 2023

I want to get the current week number of the month, Is there any possible way to get that?

I already try {{now.weekOfYear}} and it works but I want the WeekOfMonth which is (1-5 weeks is a month)

 

 

2 answers

1 accepted

1 vote
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 27, 2023

Hello @jeoj 

Welcome to the community.

I believe this is possible in the Automation function for self-hosted Jira.

If you look at the documentation for date/time format smart values.

https://confluence.atlassian.com/automation/jira-smart-values-date-and-time-993924864.html

...you may notice at the bottom of the table a link to additional Java documentation.

Per that documentation you should be able to get the week of the month by using 

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

jeoj September 29, 2023

Thank you very much for your help!

I used {{now.format("W")}} and get the week of the month :)

Kaniawati Zainal Abidin March 26, 2024

Hi @jeoj @Trudy Claspill 

 

I'm new here and considered a newbie Jira user. Trying to use the Jira automation. Saw this thread regarding getting the "week format". Appreciate your guidance. Thanks in advance.

Where do you specify {{now.format("W")}} in Jira as i'm trying to get the week but got the long string format Sprint Week 2024-04-24T04:35:40.3+0000 when using this Jira Smart value Sprint Week {{now.plusWeeks(4)}}.creatre_epics View result.jpgcreatre_epics PlusWeek.jpgif i use Sprint Week {{now.weekOfYear}}, it will only provide me the current week of the year & not the future.

creatre_epics WeekYear.jpg

 

And putting in summary Sprint Week {{now.weekOfYear(4)}} does not work at all as it does not even print out the week.

creatre_epics Week4.jpg

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 26, 2024

Hello @Kaniawati Zainal Abidin 

Please start a new Question to ensure your question gets better visibility in the community. The only people who have seen your additional to this older, answered post are the original author, responders, and anybody that elected to watch it. You can better utilize crowd sourcing in the community to get help if you start a new Question.

If this older post is relevant to your question, then include a link to it in your new post.

It is also important to tell us the hosting type of your Jira instance. Is it the Cloud/SaaS hosting model or the self-hosted Server or Data Center product? The Automation functionality has significant differences between those hosting models.

It seems like you might already have a post where you are asking this question:

https://community.atlassian.com/t5/Jira-Software-questions/Automation-on-creating-Epic-under-issue-in-advance-X-number-of/qaq-p/2653178

0 votes
Stephan Griesel July 2, 2024

Worth mentioning it is with lowercase w and not W as the accepted answer

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 3, 2024

According to the documentation:

https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html

...a lower case "w" will get you the week of the year (1-52) while an upper case "W" or upper case "F" will get you the week of the month, which is what the author asked for.

I haven't recently tested both recently, but I would be surprised to learn that "w" gives you the week of month.

Stephan Griesel July 4, 2024

Ah yes you are correct, week of year indeed with "w"

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events