Exclude non-working hours and weekends in time difference between statuses
Asked by James Wardle:

We're trying to decipher the time difference between when a ticket is set to In Progress and when it is set to Done.

Currently we have a custom field that sets the date/time for In Progress when the ticket is set to that, and a custom field that sets the date/time for Done when the ticket is set to that. There is then another custom field that works out the difference between the two date stamps (worked out as {{issue.customfield_10267.diff(issue.customfield_10266).hours}}).  

All of the above using automation rules.

However we have two problems:

a) the time difference doesn't exclude non-working hours and weekends. Is there anyway to set it to just show working hours?

b) we have members of a team across different time zones. They all work 09:00-18:00. If it is possible to set working hours, would the data be skewed by the timezones?  

Hopefully that explains it but any help would be appreciated.


Answers:
author: Ravi Sagar _Sparxsys_
body: Hi [@James Wardle](/t5/user/viewprofilepage/user-id/4070332)

Try this and let me know if it works.

```
 {{issue.customfield_10267.diff(issue.customfield_10266).businessDays}}
```

This will give you days not hours but if you look at this page you will get more ideas: <https://support.atlassian.com/jira-software-cloud/docs/smart-values-date-and-time-functions/>

For timezone I expect this to still work but test it for users from other time zones as well.

I hope it helps.

Ravi

comments: author: Bill Sheboy
body: Hi [@James Wardle](/t5/user/viewprofilepage/user-id/4070332)

Yes, and...to what [@Ravi Sagar _Sparxsys_](/t5/user/viewprofilepage/user-id/853596) suggests:

* Please check with your site admin for the time tracking settings of working days and hours. See how those align with your understanding of those values.
* You may want to consider adjusting the time zone of issues (perhaps to the assignee's time zone) prior to calculating the time differences. I found those relevant even when the team is in a single-location. For example:

{{issue.customfield_10267.convertToTimeZone(issue.assignee.timeZone).diff(issue.customfield_10266.convertToTimeZone(issue.assignee.timeZone)).businessDays}}

Best regards,  
Bill


author: Yuliia_Borivets__SaaSJet_
body: Hi [@James Wardle](/t5/user/viewprofilepage/user-id/4070332)

If you're still looking for a solution, check out [**Time Between Statuses**](https://marketplace.atlassian.com/apps/1221462?utm_source=Atlassian_Community&utm_medium=refferal&utm_campaign=Comment_Exclude_non_working_hours_and_weekends_20210916). My team has developed this app to monitor the execution time between statuses in the workflow (e.g. from "in progress" to "done"). Here you can set time limits to highlight overdue issues.

![864ca30d-f4c3-4bc0-a6d0-3aef4050a81a.jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/160511i8C86CB3D66FED149/image-size/large?v=v2&px=999 "864ca30d-f4c3-4bc0-a6d0-3aef4050a81a.jpeg")

You can schedule **working days, time zone, working hours, breaks, and holidays**.

![2021-09-16_9-47-22.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/160510i4016ABB9498FF632/image-size/large?v=v2&px=999 "2021-09-16_9-47-22.jpg")

Let me know if you have any questions.

comments: author: James Wardle
body: Thanks [@Yuliia_Borivets__SaaSJet_](/t5/user/viewprofilepage/user-id/4307791) !


author: Emre Toptanc? _OBSS_
body: Hello [@James Wardle](/t5/user/viewprofilepage/user-id/4070332) ,

Our team at OBSS built Time in Status app for this exact need. It has built-in business calendar support and it is available for Jira Server, Cloud, and Data Center.

Time in Status allows you to see how much time each issue spent on each status or assigned to each assignee. You can also combine statuses into consolidated columns to see metrics like Ticket Age, Cycle Time, or Lead Time.

You can calculate averages and sums of those durations grouped by issue fields you select.

![tisCloud_StatusDuration_LeadTime_with Estimates.png](https://community.atlassian.com/t5/image/serverpage/image-id/159409i9C7D41B570B48087/image-dimensions/247x111?v=v2 "tisCloud_StatusDuration_LeadTime_with Estimates.png") ![tisCloud_StatusDuration_LeadTime_Average.png](https://community.atlassian.com/t5/image/serverpage/image-id/159410i79489285985A46AE/image-dimensions/242x81?v=v2 "tisCloud_StatusDuration_LeadTime_Average.png")

![tisCloud_StatusDuration_LeadTime_Average_TimeGrouped.png](https://community.atlassian.com/t5/image/serverpage/image-id/159408i51C393410A1A6F3D/image-dimensions/232x71?v=v2 "tisCloud_StatusDuration_LeadTime_Average_TimeGrouped.png") ![tisCloud_StatusDuration_LeadTime_Chart.png](https://community.atlassian.com/t5/image/serverpage/image-id/159411iFE75BB9E30CF99A0/image-dimensions/217x103?v=v2 "tisCloud_StatusDuration_LeadTime_Chart.png")

The app calculates its reports using already existing Jira issue histories so when you install the app, you don't need to add anything to your issue workflows and you can get reports on your past issues as well.

As I stated before, the app has custom calendar support. For each report type you can define your own calendars with your own working days, working hours, holidays and timezone.

Time in Status reports can be accessed through its own reporting page, dashboard gadgets, and issue view screen tabs. All these options can provide both calculated data tables and charts.

Using Time in Status you can:

* See how much time each issue spent on each status, assignee, user group and also see dates of status transitions.
* Calculate averages and sums of those durations grouped by issue fields you select. (For example, see average InProgress time per project and per issue type.)
* Export your data as XLS, XLSX, or CSV.
* Access data via REST API. (for integrations)
* Visualize data with various chart types.
* See Time in Status reports on Jira Dashboard gadgets

<https://marketplace.atlassian.com/apps/1211756/>

EmreT

comments: author: James Wardle
body: Thanks [@Emre Toptanc? _OBSS_](/t5/user/viewprofilepage/user-id/527548) !


author: Mehmet A _Bloompeak_
body: Hi [@James Wardle](/t5/user/viewprofilepage/user-id/4070332) ,

For this specific need, we developed [Status Time app](https://marketplace.atlassian.com/apps/1221826/status-time?hosting=cloud&tab=overview). It provides reports on how much time passed in each status excluding non-working hours.

Once you enter your working calendar into the app, it takes your working schedule into account too. That is, "In Progress" time of an issue opened on Friday at 5 PM and closed on Monday at 9 AM, will be a few hours rather than 3 days. It has various other reports like assignee time, status entry dates, average/sum reports by any field(eg. average in progress time by project, average cycle time by issue creation month). And all these are available as gadgets on the dashboard too.

![WorkingHoursAndHolidays.png](https://community.atlassian.com/t5/image/serverpage/image-id/160539i4BAAB13E02E4302D/image-size/large?v=v2&px=999 "WorkingHoursAndHolidays.png")

Regarding your second question about having members in different time zone, I think that you should extend your working calendar to the union of these time zones. That is, if you have members in Germany and US with working hours starting at 9 AM to 18 PM in their own time zones respectively, you should create a working calendar which starts 9AM Germany Time and ends at 18 PM US time as in below screenshot. Because these are time ranges that your company is open and handling issues.

![UnionOfMembersWorkingSchedule.png](https://community.atlassian.com/t5/image/serverpage/image-id/158462i63648193F7FA831F/image-size/large?v=v2&px=999 "UnionOfMembersWorkingSchedule.png")

comments: author: James Wardle
body: Thanks [@Mehmet A _Bloompeak_](/t5/user/viewprofilepage/user-id/3740047)


Tags: atl-gruland