Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,370,123
Community Members
 
Community Events
168
Community Groups

Calculate how much business time it happens between 2 dates (weeks, days, hours, minutes)

Edited

Hi,

I'd like to know if you can help me with this: I'm trying to calculate how much business time it happens between 2 dates (weeks, days, hours, minutes), for example:

  • Date A: 2022-08-18 10:00 AM
  • Date B: 2022-08-26 02:30 PM

* BusinessDays (business days are considered to be Monday to Friday, 9am to 6pm)

I need to calculate the business time between Date A and Date B: 1w 1d 4h 30m

 

Thanks in advance!!

1 answer

0 votes

Hi @Nicolás Donnelly Kehoe and welcome to the community!

This can be done with automation, but I'd need further context into how you're planning to use this data.  For example, if you're looking to capture it in a report/dashboard, you'd need to capture the data in a custom field vs sending a communication (comment, slack/teams, email), it could just be in the body of the message. 

Here's a quick example of how it could work (I'm using Now and Due Date):

  • TRIGGER: Field Value Changed (Due Date)
  • ACTION: Add Comment
    • {{now.diff(issue.dueDate).businessDays}}
    • To get hours, mins, seconds, you'd need to do some math against that... Weeks = {{#=}}now.diff(issue.dueDate).businessDays}}/5{{/}}
      Hours = {{#=}}now.diff(issue.dueDate).businessDays}}*8{{/}}

Hi @Mark Segall 

Thanks for you response!

I've tried using that function but I think it returns just the number of days between those dates. I believe it doesn't include number of hours, minutes. 

For more context, I'm trying to create an automation to log work when an issue goes from WIP to DONE. 

Thanks again

Mark Segall Community Leader Sep 01, 2022

Sorry - Edited my response after.  You'll need to perform some math functions to get the breakdown you're looking for, but it all starts with Date Diff and businessDays

Mark Segall Community Leader Sep 01, 2022

Unless someone beats me to it, I'll spend a little time on this later today to try and help with exact math functions.

Thanks a lot Mark! I really appreciate your support!

I'll also try to apply what you have shared with me before.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS

Atlassian Community Events