How to add current date field in a confluence template

Hi all,

I'm currently working on a knowledge template in a confluence space. 

I'm looking for a solution to have a filed which is filled whith the current date when the template us used by a user.

How can a do this..

Cheers Jörg

3 answers

3 accepted

1 vote
Thomas Schlegel Community Champion Aug 30, 2017

Hi Jörg,

I would create a user macro "creationdate" (since this is what you want, I think):

## Macro title: creationdate
## Macro has a body: N
##
## Developed by: Thomas Schlegel

## @noparams

$action.dateFormatter.formatDateTime($content.getCreationDate())

Then, add the new macro "creationdate" to your template.

The creation date of the page is the same as the usage date of the template.

Thank you Thomas for your answer.

Just for me as a Confluence rookie... how do I add the user macro to the template?

Thanks again..

Thomas Schlegel Community Champion Aug 30, 2017

You create a user macro in your admin section. 

The user macro is added the same way as a regular macro. You find it in your list of macros after you've created it.

I've written an article about creating user macros, maybe it helps you:

https://community.atlassian.com/t5/Confluence-articles/The-Admin-s-tale-User-Macro-filtering-a-Confluence-table/ba-p/459369

But if not, don't hesitate to ask again :-)

Good Morning Thomas,

I tried out your macro and it works well so far but...only in a native page template like "plain page"

Whe I try to place it in a template like "knowledge article" it didn't work !?!

I've no clou what te reason can be...

Please help..

-------------------

Please forget what I've wrote - it all works well... Thank you for your support!

Cheers Jörg

Thomas Schlegel Community Champion Aug 31, 2017

You're welcome, great you've made it :-)

If you think, your question is answered, please mark it as answered. With such a marker, other user may find answered questions more easy.

Viele Grüße aus Hamburg

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,941 views 27 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