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
Community Members
Community Events
Community Groups

Days In Status

Been wrestling with how to know how many days an item has been in the current status. Well with the help of our community, I put together some ScriptRunner fields that seems to be doing the job for me.

Fist I created a Time of Last Status Change fields using Script Runner's Field feature. This is a provided feature. I called this field Status Change Date.

Then I created another field using the Custom Script Field. I took today's date minus the Last Status Change field (created above) and output it as a number.

Code in the Days Since Created field using the Custom Script field

import com.atlassian.jira.component.ComponentAccessor
import java.sql.Timestamp
import java.time.DayOfWeek
import java.text.SimpleDateFormat

import com.atlassian.core.util.DateUtils
import com.atlassian.jira.datetime.LocalDate

def enddate = new Date() as Date
def startdate = issue.getCreated()

Integer daydelta = enddate - startdate

return daydelta


This community has been a great help to me and I hope this helps others




Log in or Sign up to comment

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you