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

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

Render value of Date to a particular dateFormat in JETI Velocity template for HTML Email Notification

Hi

I am using JETI to send HTML format emails to users. I have used $!jetiFieldRenderer.renderCustomField($issue, 'customfield_XXXX')) to get the value from the Datepicker.

The date is displayed in the format yyyy-mm-dd HH:MM:SS.m (2014-07-10 06:59:00.0) but I want to display as dd-mmm-yyyy hh:mm (10-Jul-2014 06:59)

I tried using $!DateFormatter.format('mm/dd/yyyy', $issue.getCustomFieldValue("customfield_XXXX")) but obviously I have'nt understood the concept here.
I read that there is an option like
jetiFieldFormatter
DateFormat getJavaDateTimeFormat(int dateStyle, int timeStyle, String locale);
String formatSafely(DateFormat dateFormat, Date value);

But I dont know how to this method. Could someone post an example and help me out here.

2 answers

1 accepted

2 votes
Answer accepted

This works
If you are using Jira Email this issue and use a VM for rendering HTML emails. Then the JETI team has implemented a new feature since version 5.3.1

## Example using Java DateFormat with a pattern

#set($dtf = $!jetiFieldFormatter.getJavaDateTimeFormat("yyyy-MMM-dd hh:mm"))
Issue created: $!jetiFieldFormatter.formatSafely($dtf, $!issue.created)

##Example using JIRA DateTimeFormatter with a DateTimeStyle name
##customfield_10000 is a DateTimePicker field

#set($jdtf = $!jetiFieldFormatter.getJiraDateTimeFormatter("RELATIVE_ALWAYS_WITH_TIME"))

Date Time Picker Field: $!jetiFieldFormatter.formatSafely($jdtf, $!jetiFieldRenderer.renderCustomFieldAsObject($issue, 'customfield_10000'))

In which file do we need to add this code?

 

In any VM file?

 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Agile

Master the art of thinking big, working small: A conversation with John Cutler

Hello all! It has been 20 years since the agile manifesto was introduced, and closer to 40 years since software development began moving away from a waterfall-type approach. While many teams have ...

1,466 views 11 28
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