So this (as a macro) gives me today's date in a page:
$action.dateFormatter.formatGivenString("dd-MMM-yyyy", $content.currentDate)
But what I want to do is today's date - a number of days i.e. currentDate - 1d
Any ideas?
This should work (current date - 3d):
#set ( $date = $action.dateFormatter.calendar )
$date.setTime($content.currentDate)
$date.add(6, -3)
$action.dateFormatter.formatGivenString("dd-MMM-yyyy", $date.time)
as a bonus, in Confluence-styled format:
#set ( $date = $action.dateFormatter.calendar )
$date.setTime($content.currentDate)
$date.add(6, -3)
<time datetime="$action.dateFormatter.formatGivenString('yyyy-MM-dd', $date.time)"/>
Genius.. worked perfectly. I literally would never have worked this out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.