Hi @masd1 -
Use the below snippet, Its working -
#set($spToolsClass = $spTools.getClass())
#set($dateClass = $spToolsClass.forName("java.util.Date"))
#set($calendarClass = $spToolsClass.forName("java.util.Calendar"))
#set($dateObject = $dateClass.newInstance())
#set($calendarInstance = $calendarClass.getInstance())
$calendarInstance.setTime($dateObject)
$calendarInstance.add(5,-7)
#set($formattedDate = $spTools.formatDate($calendarInstance.getTime(), "MM/dd/yyyy HH:mm"))
Current Date: $dateObject
Formatted Date: $formattedDate
@baoussounda - You were close.
Please note - Here 5 is constant static value representing DATE. For more information refer the below Java doc from Oracle Java. You can use -7 to subtract 7 days from the current Date.
$calendarInstance.add(5,-7)
Mark it as solved, If it helps.