Insert current date in a Confluence template (onDemand)

I am trying to add the current date to a template similar to Meeting Notes. Running OnDemand so adding a user macro is not an option as described here: https://answers.atlassian.com/questions/25481

The Meeting Notes template uses  and works great but only works on that specific blueprint. 

Is there any plugin or way of automatically inserting the current date with the Confluence Cloud version?

2 answers

1 accepted

I used the ‘CYO Create-Your-Own Custom Macro’ Macro to display the current date using this code:

<h1>
<script type="text/javascript">
    var d = new Date();
    var curDate = d.getDate();
    var curMonth = d.getMonth() + 1; //Months are zero based
    var curYear = d.getFullYear();
    var dateCode = ((curMonth<=9 ? '0' + curMonth : curMonth) + "" + (curDate<=9 ? '0' + curDate : curDate) + "" + curYear)
    document.write(dateCode.small());
</script>
</h1>

Hi

This doesn't work for me :(

After pasting this in left window it is treated literally as text and the javascript code is displayed in one line on the page.

Does anyone know why? And where are docs which explains what is the difference between left and right window?

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 Friday 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...

292 views 11 10
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