Format date fields in Xporter

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.

2 answers

1 accepted

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.

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} ?

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

134 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you