minus month javascript date
var d = new Date("January 14, 2012"); console.log(d.toLocaleDateString()); d.setMonth(d.getMonth() - 3); console.log(d.toLocaleDateString());
Here is what the above code is Doing:
1. Create a new Date object with the date January 14, 2012.
2. Print the date to the console.
3. Subtract three months from the date.
4. Print the date to the console.