In one of my projects, I need to get the year data of duedate for all issues.
I want to fill it into a calculated customfield. I find a code but did not work. The code is below;
if (duedate==null) return null;
return String.format("%tY-%tm", duedate, duedate);
Can anyonehelp me with this ? Thanks.. Levent
You need to create a JMCF Calculated Number Field that returns just the year, as a number so that sorting and querying works best.
The formula would be:
return issue.get(“duedate”) == null ? null : issue.get(“duedate”).getYear() + 1900;
I Have magaged to get it somehow.
The code I used is below:
duedateTimestamp = issue.get("duedate");
long timestamp = duedateTimestamp.getTime();
Calendar cal = Calendar.getInstance();
duedateYear = cal.get(Calendar.YEAR);
That formula gives me just the year section of my duedate and that was I need.
Thanks for your help.
Go to Administration -> System -> General Configuration -> Advanced Settings and check the settings for jira.date.picker.java.format and jira.date.time.picker.java.format. These settings control the way dates are displayed in date picker type fields. For the correct formats check this documentation.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG