Skip to content

Instantly share code, notes, and snippets.

@stevewithington
Last active April 16, 2021 08:55
Show Gist options
  • Save stevewithington/6124745 to your computer and use it in GitHub Desktop.
Save stevewithington/6124745 to your computer and use it in GitHub Desktop.
Simple JavaScript to get the number of days in any given month of any year. Works for February and accounts for leap years! credits: http://www.dzone.com/snippets/determining-number-days-month
function daysInMonth(iMonth, iYear) {
return 32 - new Date(iYear, iMonth, 32).getDate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment