1 // instantiate a date object
2 var dt = new Date();
3
4// dt.getMonth() will return a month between 0 - 11
5// we add one to get to the last day of the month
6// so that when getDate() is called it will return the last day of the month
7 var month = dt.getMonth() + 1;
8 var year = dt.getFullYear();
9
10// this line does the magic (in collab with the lines above)
11 var daysInMonth = new Date(year, month, 0).getDate();
1 var dt = new Date();
2 var month = dt.getMonth();
3 var year = dt.getFullYear();
4daysInMonth = new Date(year, month, 0).getDate();
1 <script type="text/javascript">
2 var dt = new Date();
3 var month = dt.getMonth();
4 var year = dt.getFullYear();
5daysInMonth = new Date(year, month, 0).getDate();
6</script>