How to Subtract 30 Days From the Current Date in JavaScript

added by JavaScript Kicks
10/3/2022 4:07:48 PM

717 Views

To subtract 30 days from the current date in JavaScript: Use the Date() constructor to create a new Date object with the current date. Call the getDate() method on this object to get the days. Subtract 30 from the return value of getDate(). Pass the result of the subtraction to the setDate() method.


0 comments