Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Calculating time to resolution using a scripted field in Script Runner

Hi,

I am looking at creating a calculated scripted field in Script runner based on the Days:Hours:Minutes to resolution.

The have managed to do this calculation to based on the numbers of days, but not down to the hours and minutes.

 

return (issue.resolutionDate != null) ? String.format("%d day(s)",(int)((issue.resolutionDate.getTime() - issue.getCreated().getTime()) /(1000*60*60*24))) : "N/A" ;

 

Thanks in advance

5 answers

Hello Dear , Am currently facing issues with the script to calculate "Total time to complete" from status Open (To Do) - Complete (Close).
Could you please help us with a script to fulfill this requirement.  Let us know if it is possible to calculate the time from "To Do" status in workflow? 

Thanks in advance

Phaneendra Babu B

Thanks, this is working as expected now.

Hello!

You may do the similar with CelesteCS Math for Confluence, which allows any calculations in Confluence, including any manipulations with table data. Date parameters and functions, like NOW() and DATE() are supported.

Assume you have a table with three columns and three rows on your page – from A1 till C3, where row 1 is the header row. The sum calculation formula for rows 2 and 3 will be simple:

SUM(Table1.A2:C3)

There is a plenty of other functions in the macro, so you may perform any calculations using formulas in EXCEL style.

Thanks!

 

Hi @djamal 

I am trying to do the same. Can you help me in getting the hours and days?

I was able to get the no of day by using resolvedDate - createdDate. 

Thank you

Hello Everyone ,

Am currently facing issues with the script to calculate "Total time to complete" from status Open (To Do) - Complete (Close).
Could you please help us with a script to fulfill this requirement.  Let us know if it is possible to calculate the time from "To Do" status in workflow?  

Below is the script currently giving results from status "In Progress -> Complete". Help us to get results from status "Open ->Complete".  

 

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.CustomFieldManager;

import  java.util.Date.*

def customFieldManager = ComponentAccessor.getCustomFieldManager();
def dateFieldObject= customFieldManager.getCustomFieldObjectByName('Progress Start Date');
def dateFieldObject2= customFieldManager.getCustomFieldObjectByName('Progress Closed Date');

def dateValue
def dateValue2
if(issue.getCustomFieldValue(dateFieldObject) && issue.getCustomFieldValue(dateFieldObject2))
{
   dateValue=  issue.getCustomFieldValue(dateFieldObject) as Date    
   dateValue2=  issue.getCustomFieldValue(dateFieldObject2) as Date    
 /*  return dateValue2.getTime() - dateValue.getTime() */
    log.warn("success" + dateValue);
    log.warn("success" + dateValue2);

   return (dateValue2.getTime() - dateValue.getTime())/1000 as int
       log.warn("success");

 

 

Thanks in advance

Phaneendra Babu B

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

How to log work and track time in Jira when a person is part of multiple teams

  The manager’s daily activities include a list of challenges to reach high levels of efficiency for their teams. Part of these challenges is related to how to deal with the worklog systems sin...

92 views 2 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you