Forums

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

Calculating miniutes between 2 time/hour custom fields.

Humberto Gomes
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 Champions.
August 8, 2023
next challenge, this is a small piece of a larger project.
Scope:
2 Date and Time custom fields.
  • Start date
  • End Date.
Compare both dates and:
(where I need your help):
Custom Field Number "Total Time" = Total minutes between both (End Date - Start Date).

Custom Field Number "Working Minutes First Hour" = 0 to 60
number of minutes (60 max) within the first 60 minutes during weekdays

Custom Field Number "Working minutes Next hours" = number of hours (or minutes) in start and end date range that bellongs to a working day (monday 00:00 to friday 23:59)

Custom Field Number "Total minutes NON working day" = number of hours (or minutes) in start and end date range that bellongs to a NON woking day (Saturday 00:00 to Sunday 23:59 + List of bank holidays)

Custom Field Number "Total minutes Night Time" = Total time between 22:00 and 07:00.

Examples:
Start Time = 2023/08/08 19:30; End Time 2023/08/08 21:00
Total Time = 90
Working minutes First Hour = 60  (from 19:30 to 20:30)
Working minutes Next Hour = 30   (from 12:30 to 21:00)
Total minutes NON working day = 0
Total minutes Night Time = 0
..
..
Examples:
Start Time = 2023/08/04 21:30; End Time 2023/08/05 01:15
Total Time = 225
Working minutes First Hour = 60   (from 21:30 to 22:30)
Working minutes Next Hour = 90   (from 22:30 to 23:59)
Total minutes NON working day = 75 (from 00:00 to 01:05)
Total minutes Night Time = 195  (from 22:00 to 01:15)
..
..
These are to be added as automation, once the ticket is created.

3 answers

1 accepted

0 votes
Answer accepted
Humberto Gomes
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 Champions.
October 17, 2023

Hi,

Completing and closing this post.

 

some of the rules implemented:

Start and end times are custom fields.

 

{{issue.customfield_11506.diff(issue.customfield_11507).minutes}}

 

{{issue.customfield_11506.diff(issue.customfield_11507.withHour(7).withMinute(0)).minutes}}

 

{{issue.customfield_11506.withHour(22).withMinute(0).diff(issue.customfield_11507).minutes}}

 

540 + {{issue.customfield_11507.withHour(22).withMinute(0).diff(issue.customfield_11507).minutes}}{{issue.customfield_11506.diff(issue.customfield_11507.withHour(0).withMinute(0)).minutes}}

 

{{issue.customfield_11506.diff(issue.customfield_11506.withHour(7).withMinute(0)).minutes}} + {{issue.customfield_11506.withHour(22).withMinute(0).diff(issue.customfield_11507).minutes}}

 

{{issue.customfield_11507.withHour(0).withMinute(0).diff(issue.customfield_11507).minutes}}-60

 

{{issue.customfield_11506.diff(issue.customfield_11507.withHour(0).withMinute(0)).minutes}}

 

ScreenHunter 2195.png

0 votes
Humberto Gomes
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 Champions.
August 9, 2023

Custom Field Number "Total Time" = Total minutes between both (End Date - Start Date).

 

Solution:

{{issue.customfield_11506.diff(issue.customfield_11507).minutes}}

 

ScreenHunter 1730.png

0 votes
Bill Sheboy
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 Champions.
August 8, 2023

Hi @Humberto Gomes 

Please review this documentation to learn how to perform that type of date/time math on fields for your automation rule:

https://confluence.atlassian.com/automation/jira-smart-values-date-and-time-993924864.html

Kind regards,
Bill

Humberto Gomes
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 Champions.
August 9, 2023

@Bill Sheboy

 


Thank you for providing this documentation.

I intend to enhance this post by incorporating the solutions we have found and outlining the challenges that lie ahead.

Like • Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer