Date and time macro

How to include current date and time by macro in the conflunce page? Any possiblities..?

2 answers

1 accepted

0 votes
Accepted answer

use the dateFormatter's formatGivenString() method to specify a format:

$action.dateFormatter.formatGivenString("dd-MMM-yyyy", $some_date)

You can use other methods .

follow API docs on it:

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

Hello Uththira,

Create new user macro form Confluence admin -> User macros -> create new macro and put the below on bottom of the Template.

$action.dateFormatter.formatGivenString("dd-MMM-yyyy hh:mm:ss", $content.currentDate)

Give the macro name. example- current-date-time. Save the macro

Inser macro in page {current-date-time}

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in United States

Topic Tuesday: What's your favorite topic?

Good morning All, Our goal is to get you into the habit of while enjoying your favorite morning drink you are checking the NOVA "space" for topics and comments. Your input is really needed and...

62 views 4 0
View post

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