Days of month

function getDaysOfMonth(month, year) { var _year = year || new Date().getFullYear(); return new Date(_year, month, 0).getDate(); } getDaysOfMonth(2); // Feb, 2016 -> 29 days getDaysOfMonth(2, 2017) // Feb, 2017 -> 28 days

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.