Created
April 18, 2019 06:17
-
-
Save pdk/b2fb3cecf1b1b484b272539740011156 to your computer and use it in GitHub Desktop.
compute number of days in a month
This file contains 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
func daysInMonth(y, m int) int { | |
dayZero := 0 | |
return time.Date(y, time.Month(m+1), dayZero, 0, 0, 0, 0, time.UTC).Day() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment