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

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

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)

 

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
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
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

865 views 23 12
Join discussion

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