判断闰年(go语言版本)

 1 import "strconv"
 2 
 3 func IsLeapYear(y string) bool { //y == 2000, 2004
 4     //判断是否为闰年
 5     year, _ := strconv.Atoi(y)
 6     if year%4 == 0 && year%100 != 0 || year%400 == 0 {
 7         return true
 8     }
 9 
10     return false
11 }

 

posted @ 2014-05-22 19:42  sndnvaps  阅读(647)  评论(0编辑  收藏  举报