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

How can I get current year in confluence footer-conten.vm

Peter Kahn
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.
October 30, 2015

How can I get a current year in ./confluence/decorators/includes/footer-content.vm?   I can get a date string by $action.getDateFormatter().getCurrentDate() but want to use the DataFormatter to format for just year but it takes Date objects and I seem to lack one.

 

I want to put  copyright my-corp $year    in the footer.

 

Thanks

 

1 answer

0 votes
Bhushan Nagaraj
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.
October 30, 2015

Hey Peter,

For a list of all the parameters available in the context refer to https://developer.atlassian.com/confdev/development-resources/confluence-architecture/confluence-internals/velocity-template-overview/confluence-objects-accessible-from-velocity

Try getCalendar() using DateFormatter and getting the YEAR attribute.

https://docs.atlassian.com/atlassian-confluence/latest/com/atlassian/confluence/core/DateFormatter.html

$dateFormatter.getCalendar().getInstance().get(Calendar.YEAR)

 

Peter Kahn
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.
October 30, 2015

So this sort of works but I feel like I should bet able to get year without a hard coded value #set ($calendar = $action.getDateFormatter().getCalendar()) <p style="text-align:center"> Copyright © 2008 - $calendar.get(1)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events