For my website I am trying to get the number of days for the CURRENT month for a certain feature.
I have seen examples online that get days of a specified month, however I need to get the days of the CURRENT month and find how many days are left of that month.
Here is the code I managed to put together:
function myFunction() {
var today = new Date();
var month = today.getMonth();
console.log(month);
}
myFunction();
Does this do what you want?
function daysInThisMonth() {
var now = new Date();
return new Date(now.getFullYear(), now.getMonth()+1, 0).getDate();
}