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

Date format for script field


  I have created a Date Time Picker script field, Is there anyone can help me remove the Times tamp on my return. Currently field " MM/dd/yyyy hh:mm a (30.04.2018 00:00) " and i will like to get " MM/dd/yyyy (30.04.2018)" this format instead.


3 answers

1 accepted

7 votes
Answer accepted


You can customise the date output using a ScriptRunner script field whilst maintaining the current level of search functionality with use of a "Custom" type field.

1. Create a new script field with the following fields set as specified:

Template: "Custom"

Custom Template: 


Here are some useful docs regarding custom templates

Inline Script: (This is for testing purposes, you can put whatever script you want here so long as it returns a date)

def date = new Date()

2. Once you click "Add" to add the new field, you need to change the "Searcher" (see here). If you select it as a "Date Time Range picker" then the value will be searchable from within JQL as a date.

NOTE: Script fields are not updated in the Lucene index until either a re-index is run or the individual issue is updated. Script fields are best used for calculating values based on other values in the issue.

I hope this helps!


Pretty useful,  I hope the documentation is updated to include examples like the one which you just shared.



Thank you Stephen.  We use this exact technique!

The only side-effect to this technique that I can see is that the "dates" now will display in the main issue panel.  For some users, this is a pro, others a con.

The following statement needs to be in bold AND red AND larger font AND blink!  It's important! 


NOTE: Script fields are not updated in the Lucene index until either a re-index is run or the individual issue is updated. Script fields are best used for calculating values based on other values in the issue.


If your scripted field is getting values from a db or a JQL search or something besides the issue itself (or I think a linked issue), then you're values will be out of synch with your Lucene index. (lesson learned)

Hey @David Sumlin and @Tarun Sapra

I'm glad my answer was enlightening! If you think that others would benefit from my answer, feel free to mark it as accepted so others can more easily benefit from it.

I believe the indexing detail is already specified in the documentation:

It’s also possible to search on these values if you set up one of the four shipped searchers. If you do, the value is calculated and stored in the index at the time that the issue is indexed, eg when it is modified or transitioned, or when you do a full reindex.


You can only reliably use a calculated field to display a value that is based on the issue’s fields, or subtasks' fields, or linked issues. The reason why is because the value in the Lucene index is only updated when the issue is updated.

Hi @Stephen Cheesley [Adaptavist] 


can you tell me, how i can show(custom template) in Dates column?


If i used your custom template, i see value in Details column. 



I set the"Date Time Range picker" in property of custom field.



This doesn't work for me using the example exactly as is. The result still includes the timestamp.


def date = new Date()

Custom formatter:


Using the preview, I get "10/01/2019 11:25 AM"


Jira version: v7.13.8
SR version: 5.6.2

1 vote
Tarun Sapra Community Leader Sep 25, 2018

Hello @d-sokolovskiy

This feature is now supported out of the box

  • [SRJIRA-2668] - Add a Script Fields Template for Dates without timestamps

Hello jiradev,

I think your only option is to implement Text script field and manually convert the date into the format you want. You can take a look at how to do it in this answer by Kristian from Adaptavist:


Hi Martin,                                                                                                                     
Thank you for your answer. Everything works perfectly! But the problem is that the script field from the Dates section moved to the Details(text field section) on my screen. Do you have any ideas how can this be fixed?


Hm, you are right. There is no control over where the fields are shown (Date ones on the right in Dates panel, People under People and so on). Making the field of text type unfortunately means it will be showed together with the other text ones. :(


It also means that it can't be searched/filtered in JQL using date functions or datepickers.

That's true, I think the only option would be to implement a new custom field which would extend com.atlassian.jira.issue.customfields.impl.DateCFType  without any specific implementation. Only view and edit templates for this new custom field would be different - only date part could be edited and displayed. I wasn't able to find any regular documentation about writing new custom field types so it would expect some experience in using JIRA source code to learn how to do it.


It's aggravating since Jira already comes with the functionality we want out of the box for Due date (and I think a couple other fields).

This is completely a display/formatting issue.  We understand that there's a date component behind the scenes.  We also understand that the date could display different depending on what time zone the user is in. 

I'm actually surprised there's not an addon that has this functionality.  There's little chance that Atlassian will add this feature, since this has been a desired feature for years.

+1 from me for this type of custom field:)

Does anyone know how to clear the Due Date field value during cloning so that the new ticket does not have the old tickets' Due Date field pre populated while cloning?

I tried a post function but could not get the code right. 


Suggest an answer

Log in or Sign up to answer

Atlassian Community Events