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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • 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

Scripted Field - Date appearing as Date Time. (Field pulls date from parent)

I am using this script and the date from the parent is returning with blank Time. I want just the date to appear.

Using "Date" template on script and Date Time on the searcher I got the results I wanted of just the date only but... the date was one day off.

Currently I have it set to "Text field" template on script and free text on the searcher and its displaying date as "2021-01-04 00:00:00.0"

Thanks in advance for the help!

import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.component.ComponentAccessor;

if (issue.isSubTask())
def field = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Received Date");

if (field != null)
return issue.getParentObject().getCustomFieldValue(field);

return null;

1 answer

Hi @Duane Cronkite I guess value of the field is of java.util.Date type. So you just need to format it in "return" statement. So you have to add following lines to your source code:

  1. import java.text.SimpleDateFormat
  2. import java.util.Date
  3. SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd")
  4. return formatter.format(issue.getParentObject().getCustomFieldValue(field))

Suggest an answer

Log in or Sign up to answer

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