How to user DateTimeFormatter to parse a date to dd.mm.yyyy

I’ve been trying to use Jira’s DateTimeFormatter to format a date to my desired dd.mm.yyyy ( ex. 25.03.2016) date format. But the only method is format(Date date1), which doesn’t let me specify the pattern. So I thought I should use withStyle prior to calling the format method. That method has three overloads: withStyle(DateTimeStyle), withStyle(String) and withStyle(Locale). I’ve tried these:

 1. formatter.withStyle(DateTimeStyle.DATE).format(date)
 2. formatter.withStyle(DateTimeStyle.DATE_PICKER).format(date)
 3. formatter.withStyle("dd.MM.yyyy").format(date)

All of the above styles return this : 25/MAR/16

My guess is that, it’s getting the format of the system or Jira itself. .I’ve changed date and time formats under General Configuration | Advanced settings. Date pickers correctly reflect this change. Is there anywhere I can change the date display format?

Hi Mikola,

I think that JIRA provided dateTimeFormatter is designed to format date/time in format configured in JIRA only. So, if you necessarily need to format date/time in some other custom format, you need to use java.text.DateFormat.

Thank you.