Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements


  • Give kudos
  • My kudos


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Scriptrunner Change Date Format

Hi Community

I would like some assistance with scriptrunner - I want to return the Due Date value in a preferred format as currently with Dataplane reports the date format (as displayed) is not ideal.

Currently in Dataplane the Due Date value is displayed as YYYY/MM/DD however several teams want this to be displayed as DD/MM/YYYY instead (like it is in Jira). Dataplane vendor (Arsenale) advised their addon doesn't currently support changing this but suggested a scripted field maybe able to do it.

Essentially I want to create a scripted field that returns the due date value of the issue in my preferred format. I have had a poke around the community forums and appears to be some solutions for customfields, but due date is a system field (and I can't quite work out what to do).

Any help would be greatly appreciated.

Regards, Jamie 

1 answer

1 accepted

0 votes
Answer accepted

Because this is an internet forum, allow me to first tell you that what you want is wrong. yyyy-mm-dd is God's own format that avoids all ambiguity, sorts naturally and is ISO-approved.

But if you really want to, this Groovy code reformats the due date:

import org.joda.time.format.*
DateTimeFormatter fmt = DateTimeFormat.forPattern("dd-MM-yyyy")
fmt.print issue.getDueDate().getTime()

Go to the 'Script Fields' admin section, and create a new Script Field of type 'Custom Script Field', paste that in and preview with an issue that has a due date.

For Groovy scripting, a useful trick is to append '.class' to a known object to find it's type, then google that class to find what methods the class has. I start with 'issue', then find I can do 'issue.getDueDate()', and then google how to format a java.sql.Timestamp.

Thanks @Jeff Turner this is helpful and will do what the users want for their reporting.

Thanks also for your response - I'll give you a pass since its Friday and I can laugh it off. I guess from user's perspective the 'how it is' way is not helpful since Jira formats date fields in our instance the wrong way round but this is why we have scriptrunner to re-format things all the wrong ways :) 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Software

How to create Jira issus from Excel file?

When to use CSV importer When managing your processes in Jira, there are many occasions where you need to create a lot of tasks. Creating them one by one will cost you a lot of time and effort and i...

4,633 views 22 33
Read article

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