Format date fields in Xporter

win bolton January 16, 2013

How can I format a date/time field in the Xporter plugin template?

For example, in my Word doc I have the field ${CreatedTime} which displays as 2012-10-15 12:48:51.853

I would like to be able to format the date so that it is displayed as October 15, 2012.

3 answers

1 accepted

0 votes
Answer accepted
Xpand IT
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2013

Hi winbolton,

You can use javascript processing instructions for that.

Example:

%{var months = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); var dateParts = '${CreatedTime}'.split('-'); var month = dateParts[1]; var year = dateParts[0] ; var day = dateParts[2].split(' ')[0]; months[parseInt(month) - 1] + ' ' + day + ', ' + year;}

Check the attached template.

0 votes
Lilian Brouwer March 12, 2024

How do you get rid of the time in de day part?

 

0 votes
kaneda July 31, 2013

Hi,

this would also be interesting for me.

I used the field ${CreatedDate} within a Xporter plugin and get e.g. the output

26-06-2013.

In the issue`s detail view, instead, i see

26. Jun 2013 (german date format).

Could you tell me how i apply this german date format onto the Xporter field ${CreatedDate} ?

Tanya B. May 6, 2020

This generally works for me:

${dateformat(“dd-MMM-yyyy”):CreatedDate}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events