How do I calculate the date in JavaScript three months prior to today?
Javascript
I Am trying to form a date which is 3 months before the current date. I get the current month by the below code
var currentDate = new Date();var currentMonth = currentDate.getMonth()+1;
Can you guys provide me the logic to calculate and form a date (an object of the Date data type) considering that when the month is January (1), 3 months before date would be OCtober (10)?
Answer link : https://codehunter.cc/a/javascript/how-do-i-calculate-the-date-in-javascript-three-months-prior-to-today
Posted Mar 22, 2022, 9:13 PM UTC
10