Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get the day of week from Calendar?

Vishali
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.
October 5, 2012

Hi,

I am writing a Jelly script and am looking into - get day of week from Calendar.

In one of the posts I found this:

<core:invokeStatic className="java.util.Calendar" method="getInstance" var="CalendarField"/>

<core:invoke on="${CalendarField}" method="setTime" >
<core:arg type="java.util.Date" value="${FieldValue}"/>
</core:invoke>

<core:invoke on="${CalendarField}" method="get" >
<core:arg type="int" value="${CalendarField.DAY_OF_WEEK}" />
</core:invoke>

<log:warn>14:${CalendarField.DAY_OF_WEEK}</log:warn>
</core:forEach>

Whan used, I found this error - An int instance cannot be null. COuld somebody please help?

Thanks,

Rajani

2 answers

1 accepted

0 votes
Answer accepted
Vishali
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.
October 9, 2012

I have modified the script to look like this and it WORKED!


<!-- The current time -->
<core:invokeStatic className="java.util.Calendar" method="getInstance" var="CalendarField"/>
<core:forEach var="issue" items="${issues}">
<!-- Get the Issue from IssueManager -->
<core:invoke on="${issueManager}" method="getIssueObject" var="issueKey">
<core:arg type="java.lang.String" value="${issue.key}"/>
</core:invoke>
<!-- Get Custom Field Value -->
<core:invoke on="${customFieldObj1}" method="getValue" var="expStartDate">
<core:arg type="com.atlassian.jira.issue.IssueImpl" value="${issueKey}"/>
</core:invoke>
<log:warn> Expected Start day is : ${expStartDate} </log:warn>
<core:invoke on="${CalendarField}" method="setTime">
<core:arg type="java.sql.Timestamp" value="${expStartDate}"/>
</core:invoke>
<core:invoke on="${CalendarField}" method="get" var="dayOfweek">
<core:arg type="int" value="7"/>
</core:invoke>

0 votes
Anand Unadkat
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.
August 29, 2013

Hi Vishali,

I am trying to create automated issues, so for example create daily tasks at 9 in the morning, create monthly task every 1st day of the month and eliminate lets say Christmas day. Is there a way to do this?

Thanks a lot for your help in advance.

Anand

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira product discovery, jpd premium, product management, idea management, product discovery, jira premium, product planning, atlassian community, product development, roadmap planning, product prioritization, feature management

Introducing Jira Product Discovery Premium ✨

Jira Product Discovery Premium is now available! Get more visibility, control, and support to build products at scale.

Learn more
AUG Leaders

Atlassian Community Events