How do I add the current date to a template?

Bret Wisecarver
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 7, 2021

I am able to add a date from the content by using

 https://confluence.atlassian.com/conf71/configuring-time-and-date-formats-979423992.html 

I am not able to get this date to show the current date, it is showing the date I choose after adding the content. Is it possible to make it default to the current date?

2 answers

1 accepted

0 votes
Answer accepted
Benjamin
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 7, 2021

Hi @Bret Wisecarver ... There isn't an option on cloud. There might a possibly on server or DC if you manipulate the velocity template. 

3 votes
Fabienne Gerhard
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 7, 2021

Hi @Bret Wisecarver 

welcome to this wonderful community.

As your link is showing server link my solution may work out for you - I created a simple costumer macro which shows last date modified.

##Macro title: AUI Button
## Macro has body: N

## @noparams

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

It's working fine for us.

We use it in a table with page properties and it looks like this.

image.png

Feel free to ask for more help

Pavol Chromik
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 5, 2023

Hello @Fabienne Gerhard ,

we had similar user macro on our instance but after migration to Confluence 7.19.8(Data Center) it stop working. We moved from 7.4.18

## Macro title: Current Time
## Macro has a body: N
## Body processing: No macro body
## Developed by: Steven Behnke
## @noparams

##https://community.atlassian.com/t5/Confluence-questions/Insert-current-date-into-Confluence-page/qaq-p/313517
##$action.dateFormatter.formatGivenString("dd-MMM-yyyy hh:mm:ss", $content.currentDate)
$action.dateFormatter.formatGivenString("dd-MMM-yyyy", $content.currentDate)

It is also not working once i tried your version

 

Is there some "how to" to be able to fix it on our current Confluence version?

 

thank you

KR, Pavol

Pavol Chromik
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 1, 2024

Solution from following article helped me to get it work again. Currently we are on Confluence v8.5.14 and our user macro for current_date works correctly now.

our user macro looks like that:

## Macro title: My Macro
## Macro has a body: Y or N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: My Name
## Date created: dd/mm/yyyy
## Installed by: My Name

## @noparams

##https://community.atlassian.com/t5/Confluence-questions/How-can-I-get-the-current-date-as-a-formatted-string-in-a-User/qaq-p/2462351
$action.dateFormatter.formatGivenString("dd-MMM-yyyy hh:mm", $action.dateFormatter.getCalendar().getTime())

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events