Last active
April 16, 2021 08:55
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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