Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Issue attribute, like $!issue.created or $!issue.updated
  • Issue custom field: $!issue.getCustomFieldValue("customfield_12345"), where "customfield_12345" is the custom field key of a Date Picker or DateTime Picker field. Calling the formatter with a non-date value will render an empty string

Render Date or Date Time Values in any Timezone

To render Date or Date Time values in a timezone, both the Jira DateFormatter and Java DateFormat may be used. There is a list of Timezone IDs are available for java.

Render the Issue's due date in Alaska time using the Java DateFormat API:

Code Block
##Create a Java formatter using a java datetime pattern
#set($formatter = $!jetiFieldFormatter.getJavaDateTimeFormat("yyyy.MMM.dd z"))

##set the timezone in the formatter
$!formatter.setTimeZone($!jetiFieldFormatter.getTimeZone("US/Alaska"))

##format the date value with the formatter
Issue Due Date in Alaska time: $!formatter.format($!issue.dueDate)

Render the Issue's due date in Alaska time using the Jira DateFormatter API:

Code Block
##Create a Java formatter using a Jira formatter style, with the timezone information
#set ($formatter = $jetiFieldFormatter.getJiraDateTimeFormatter("COMPLETE").withZone($!jetiFieldFormatter.getTimeZone("US/Alaska")))

##format the date value with the formatter
Issue Due Date in Alaska time: $!formatter.format($!issue.dueDate)

Shortcut Template Methods to Format Values easier

Code Block
#renderDateTime($!issue.getCustomFieldValue("My Date Time Custom Field") "yyyy-MM-dd") ##Render the issue's "My Date Time Custom Field" custom field in the given pattern
#renderDate($!issue.dueDate "yyyy-MM-dd") ##Render the issue's due date in the given pattern

#renderDateTime($!issue.getCustomFieldValue("My Date Time Custom Field") "yyyy-MM-dd") ##Render the issue's "My Date Time Custom Field" custom field in the given pattern
#renderDate($!issue.dueDate "yyyy-MM-dd") ##Render the issue's due date in the given pattern