Skip to main content
Automatically calculate dates and times in Jira Data Center
Share on socials
A Jira ticket with special fields highlighted
Andra Dinu
Andra Dinu
Jess Thompson
Jess Thompson
8th February, 2023
Jira
Data center icon
Server icon

Automatically calculate dates and times in Jira Data Center

Get free scripts to help you work smarter with time and date fields in Jira Data Center. Turn information into reporting-ready and actionable intel for your teams.
We're going to take a deep dive on one of the script snippet collections in the Adaptavist Library: Working with dates and times.
When trying to run your work through any system like Jira, it’s common to need to work with dates, times and intervals. It can be very useful for teams to calculate how long an issue has been in a given workflow state, for instance, or to know the amount of logged time that an issue has.
These three ScriptRunner for Jira scripts are ready-made for common use cases to save you time right now, and to inspire you for future customisations. Let's dive in!

View snippet collection

Script 1: Store the time that an issue was first transitioned through a specific status

Use this helpful script to get the date an issue was first transitioned through a particular action. It doesn’t matter if it undergoes the same transition multiple times, only the first date is shown. Perhaps you work in support, you might want to track when a customer was first responded to, this can quickly be achieved by using this script in the support workflow.

Script 2: Calculate the difference between two dates

You may need to calculate the number of overall days between two custom date fields and don't want to spend time manually tracking the dates. This snippet will save you time by automatically doing this for you.
For example, you might have an impending project deadline coming up, and you need to see how long the project has been running for and make sure that your team is on track to complete the project on time.

Script 3: Calculate the working days between two dates

Now, you can easily calculate the working days between two dates with this script. For instance, you might need to work out the average working days that it takes to resolve an issue. So, you can use this snippet to track the working days between when an issue was first raised and when it was resolved.

View snippet collection

Given you some ideas? Share this post with a colleague!

Doing things the hard way?

If you're not already using ScriptRunner for Jira to lighten the load of administrative and manual tasks (and much more besides), take out a free trial. We don't think you'll ever look back.