Hi,
i am trying to customize release notes view by creating velocity template. I figured mostly everything I needed, only date format is not working properly for me. I am trying to use
$date.format("dd/MMM/yy",$versionObj.releaseDate)
But the only result is that above line literally prints out itself as string and no formated date as one would expect.
What am I doing it wrong?
tnx & brg,
K
Five years later . . .
I also had my Problems, as none of the listed classes work for me
https://thepluginpeople.atlassian.net/wiki/display/JEMH/Work+with+Dates+in+velocity+templates
But I used the formatter class provided by oracle to do this:
#set( $DateString = '' )##
$DateString.format('%1$tY%1$tm%1$td', $versionObj.releaseDate)
You need to change it a bit to fit on your purpose but this should be easily possible as you can see here:
https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html
Hi,
I know it's a little late, but if you are looking for an easier way try Intelligent Reports. It lets you design your release notes in Microsoft Word, then fill in the data using simple point and click rules. No scripting or API to learn and debug.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Velocity is printing out the literal because it can't resolve $date and/or the methods on it.
If you're doing this on JIRA, this page (http://confluence.atlassian.com/display/JIRADEV/Contents+of+the+Velocity+Context) lists all the variables automatically added to the context for your use. You probably want the dateutils variable.
Update: http://docs.atlassian.com/atlassian-core/5.0-SNAPSHOT/apidocs/com/atlassian/core/util/DateUtils.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Matthew for the provided answer.
I have already saw that link on date util, problem is as it is not clear to me, how to include dateutils inside .vm file. I have tried many ways (as doc suggests, but date util object was not included on the final printout).
Can you help me with that (using jira v4.3.3#617-r14961)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.