Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to let custom field date format to "yyyy/mm/dd"?

Harry Huang October 15, 2019

Hey guys,

I have a custom field to show the date of first to SIT Done

But the date format is not what I want

2019-10-16_095823.png

I want like "yyyy/mm/dd" format.

But I have no idea how to do it.

Can someone tell me?

 

And below is my code

package com.onresolve.jira.groovy.test.scriptfields.scripts

import com.atlassian.jira.component.ComponentAccessor

def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def created = changeHistoryManager.getChangeItemsForField(issue, "status").find {
it.toString == "SIT Done"
}?.getCreated()

def createdTime = created?.getTime()

createdTime ? new Date(createdTime) : null

 

2 answers

1 accepted

0 votes
Answer accepted
Harry Huang October 15, 2019

Just add this code will  reach my purpose

createdTime ? new Date(createdTime).format("yyyy/MM/dd HH:mm") : null
0 votes
Ollie Guan
Community Champion
October 15, 2019

Hi @Harry Huang ,

You customize the way times and dates are presented to users throughout the JIRA user interface. When specifying dates and times, they should be based on the Java SimpleDateFormat.

https://confluence.atlassian.com/adminjiraserver073/configuring-the-look-and-feel-of-your-jira-applications-861253125.html

Suggest an answer

Log in or Sign up to answer