Is there any efficient way of getting the number of days in current month using JavaScript ?
Asked
Active
Viewed 3,315 times
1 Answers
1
function _getDates(year, month) {
return new Date(year, month, 0).getDate(); // 0 + number of days
}
console.log(_getDates(2016, 07))
brk
- 46,805
- 5
- 49
- 71
-
1I used https://jsfiddle.net/mf543zh6/ It is not running though – Shivank Verma Jul 30 '16 at 09:05