Forums

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

Calculating Remaining hours

Sean Wood September 27, 2021

Hello all,

I have an SLA that is calculated based on the following:

  • 9am is the start of the next day
  • 1 day runs for 24 hours
  • Issue SLA's start at the beginning of the next day
  • SLA is a 2 day (48 hour) direction.

e.g. A Jira issues is created at 11am. The SLA for this issue will start from 9 am the next day

e.g. A jira issue is created at 7:20 am. The SLA will start from 9 am.

 

How can I calculate the remaining time within a day (give that a day starts and ends at 9 am) ?

Ultimately I am trying to add the remaining time within a day and add the SLA duration (2days) to provide a total duration.

 

Using Automation to do the above.

Hope this is clear. Any suggestions are greatly appreciated.

 

 

2 answers

1 accepted

1 vote
Answer accepted
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 Leaders.
September 27, 2021

Hi @Sean Wood 

I believe if you sketch out your algorithm, you can do this with the built-in date/time functions.  Perhaps something like this:

  • if created date/time's time value <= 0900 then
    • calculate the difference between now and 2 days from created at 0900
{{now.diff(issue.created.toStartOfDay.plusDays(2).plusHours(9))}}
  • else
    • calculate the difference between created and 3 days from created at 0900
{{now.diff(issue.created.toStartOfDay.plusDays(3).plusHours(9))}}

Here is the documentation for date/time smart values to get you started: https://support.atlassian.com/jira-software-cloud/docs/smart-values-date-and-time-functions/

Please note: your approach seems to give people a "free pass" for issues created after 0900 up to the next day.  You may want to consider why SLA doesn't start until the next day.

Kind regards,
Bill

0 votes
Zoryana Bohutska _SaaSJet_
Atlassian Partner
September 28, 2021

Hi @Sean Wood 

Also, you can try the application SLA Time and Report for Jira (created by my team). At its configurations, all date fields have the option "Based on field value". This means that the SLA starts at the date and time specified in the selected issue field.

Accordingly, if you make that the automation always correctly updates the conditional field SLA start, or you will set it manually, then under this condition the SLA will start as you need and count for 48 hours.

Kind Regards

Suggest an answer

Log in or Sign up to answer