Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
September 10, 2022 02:31 am GMT

Javascript: Get days & starting day in month

Each month in calendar will have max 28, 29, 30 and 31 days.

We can get using native JS date.

let days = new Date(2022, 8, 0).getDate();console.log(days);> 31 // days in August

First day in each month can start from any day.

let startingDay = new Date(2022, 8).getDay();console.log(startingDay);> 4 // represents Thursday

For more date utils, you can refer: DateUtils

Also, follow for updates: https://twitter.com/urstrulyvishwak


Original Link: https://dev.to/urstrulyvishwak/javascript-get-days-starting-day-in-month-5f1g

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To