Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

User macro - How can I add 5 seconds on a page creation date

ElodieB October 5, 2018

Hi,

I would like to find all page versions on a descendents tree created before the parent page creation but I would like to exclude all versions created in the same time, for example by a copy of the tree.

 

So I need to keep the parent creation date and to add 10 seconds to it.

 

I get a Calendar date with the creation date

#set ($parentPage=$pageManager.getPage($space.key,$paramParentPageName))

#set ($creationDateOriginal=$parentPage.getCreationDate())

#set ($cal = $action.dateFormatter.getCalendar())

$cal.setTimeInMillis($creationDateOriginal.getTime())

But the following line doesn't work :

$cal.add($cal.SECOND,5)

 

Could you help me please ?

Best regards,

Elodie

1 answer

0 votes
Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2018

How about something like:

#set($cal.setTimeInMillis=$creationDateOriginal.getTime()+ 5000)
ElodieB October 8, 2018

Hi,

Unfortunatly, it doesn't work, "$cal.getTime()" displays "Wed Oct 03 11:30:03 CEST 2018" and "$creationDateOriginal" displays "Wed Oct 03 11:30:03 CEST 2018" 

 

#set ($parentPage=$pageManager.getPage($space.key,$paramParentPageName))

#set ($creationDateOriginal=$parentPage.getCreationDate())

$creationDateOriginal

#set ($cal = $action.dateFormatter.getCalendar())

#set($cal.setTimeInMillis=$creationDateOriginal.getTime() + 5000)

$cal.getTime()

 

Regards,

Elodie

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events