Forums

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

How to calculate total duration between issue created date and current date

SWAPNIL SRIVASTAV
Contributor
June 5, 2020

How to calculate total duration between issue created date and current date using Scripted Fields?

But the duration should be calculated only during the business/service hours i.e. only between 08:00 to 18:00 hours and it should exclude Weekends and other Holidays.

Also, We already have JWT plugin to calculate Status Durations (Time duration when the issue was in a particular issue).

So, is there any way we can use the JWT schedule in script runner groovy script and create a Script Field for this?

1 answer

1 accepted

2 votes
Answer accepted
Thorsten Letschert _Decadis AG_
Atlassian Partner
June 5, 2020

Hi @SWAPNIL SRIVASTAV ,

is there a particular reason you're asking for the combination of a JWT schedule and a scripted field?

Given JWT, you could simply configure your schedule (see the examples including holidays here: https://apps.decadis.net/display/JWT/Schedules+Definition+Grammar#SchedulesDefinitionGrammar-Examples) and use an expression like

timeDifference({00057},{00009}, "your_schedule_name", LOCAL)

with 00057 being the current date and time and 00009 being the date and time of issue creation.

Cheers
Thorsten

SWAPNIL SRIVASTAV
Contributor
June 5, 2020

Hello @Thorsten Letschert _Decadis AG_ ,

I was not aware that we can create Custom Number Fields with JWT. Thank you. The Math/Time Expression worked.

SWAPNIL SRIVASTAV
Contributor
June 5, 2020

Hi @Thorsten Letschert _Decadis AG_ ,

The field is working properly and the duration is accurate but can I not use it in a JQL?

If I am using it in a JQL, sometimes JQL result is not proper. 

Suggest an answer

Log in or Sign up to answer