Substracting days from today's date

I need to pass the date of 14 days ago in a query that reads back items less than 14 days old in an auto index slot. What is the easiest way of substracting 14 days from today’s date in a JEXL expression? I tried using tools.date.getCalendar() and then use it to do the calculation but couldn’t get it to work.

I realize this is a basic question, but somehow it is giving me a hard time. Any help is greatly appreciated.

OK I know why it was not working yesterday. Here is the working version:

$minusfourteen = $tools.date.toCalendar($tools.date.getDate())
$minusfourteen.add(5,-14)
$comparedate = $tools.date.format(“yyyy-MM-dd”, $minusfourteen)

and $comapredate is what I will pass in my JSR query. My problem was I was trying to assign the output of add function to another variable and format that. Although it should technically work-- or so I believe – it doesn’t. I know I am just talking to myself here, but am writing this down just to share an experience.