How to get the Last day of a month in JavaScript

 

To get the  day of a month, use the Date()  object, passing it the year, the month + 1 , and zero for the day as parameters. The Date object can contain the Day of the month.

 

var month = 0; 
var day = new Date(2023, month + 1, 0);

console.log(day.toString());

Tags:

Share:

Related posts