I am new to js and I am trying to fiddle with the javascript dates. I have a following date in the format 01-JAN-2016 and I need to subtract 1 day from it. I tried
var dateVar = '01-JAN-2016'
var d = new Date(dateVar);
alert(d);
alert(d-1);
It gives me a date and time in long no. But I want it want it to be '31-DEC-2016' How can I add the format dd-MMM-yyy to it?