Skip to content
Advertisement

How to get all the dates in a month using calender class?

Here I want to display dates like

JavaScript

I can get total days in a month

JavaScript

Does anyone have an idea to help me?

Advertisement

Answer

If you only want to get the max number of days in a month you can do the following.

JavaScript

If you actually want to print every day then you can just set the day of month to 1 and keep adding a day in a loop until the month changes.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement