Forums

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

Log Work based on Date/Time difference of two custom fields

Stephen Call August 7, 2025

Hello!

We are attempting to automate the action of logging work on an issue when it transitions to the 'Done' status, while taking standard Business hours into consideration.

Our current automation is based on a custom field against the current date/time formatted for Business Days, but we would love to know if anyone has a solution to be able to capture the difference between two date/time fields with the difference being logged in native Time Tracking.

There are two hurdles that we are facing right now from our perspective:

1. How can we capture the day, hour, minute difference between two custom fields in the formatting required for 'Log Work', (i.e. 4d 3h 27m)

2. How do we take 'Business Days' into consideration to avoid capturing time that isn't during standard business hours?

Thank you!

2025-08-07 19_37_04-Audit log - Automation - MoneyMovement - Jira - Work - Microsoft​ Edge.png

2 answers

0 votes
Gaurav
Community Champion
August 11, 2025

Hello @Stephen Call 

As you are looking for native capabilities to accomplish this, I have the below suggestions:
1.For formatted print, you can use the command, prettyPrint, which displays the difference in words, e.g.: 2 days 3 hours., 

2. For calculating difference in terms of business days, you can use the below method:

Date difference {{[date1].diff([date2]).[unit]}}; where the unit can be "businessDays".

The details for both options are captured under the Date Difference section on the documentation, here.

Kindly share if this helps.

--GG

 

0 votes
Tuncay Senturk _Snapbytes_
Community Champion
August 9, 2025

Hi @Stephen Call 

You can get using diff() between two date/time fields (see how you can use diff function here in detail), then format the result for days/hours/minutes with toDuration or string formatting before passing it to the “Log work” action.

For business hours, Jira Automation doesn’t natively support excluding non-working hours from diff(). You’d need to either:

  • Pre-calculate business time with a separate field or external script, or

  • Use an external app or a Marketplace app that can handle business calendars in smart values (I don't know if there is one).

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
ENTERPRISE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events