func GetLastDay(year, month int) int {
	var day = 0
	if month > 0 && month <= 12 {
		day = daysByMonth[month-1]
	}
	if month == 2 && isLeapYear(uint16(year)) {
		day = 29
	}
	return day
}
GetLastDay returns the last day of the month
package types
import (
	gotime "time"
	"github.com/pingcap/errors"
)
type MysqlTime struct {
	year  uint16  
	month uint8   
	day   uint8   
	hour        int    
	minute      uint8  
	second      uint8  
	microsecond uint32
}
func (t MysqlTime) Year() int {
	return int(t.year)
}
func (t MysqlTime) Month() int {
	return int(t.month)
}
func (t MysqlTime) Day() int {
	return int(t.day)
}
func (t MysqlTime) Hour() int {
	return int(t.hour)
}
func (t MysqlTime) Minute() int {
	return int(t.minute)
}
func (t MysqlTime) Second() int {
	return int(t.second)
}
func (t MysqlTime) Microsecond() int {
	return int(t.microsecond)
}
func (t MysqlTime) Weekday() gotime.Weekday {
	t1, err := t.GoTime(gotime.Local)
	if err != nil {
		return 0
	}
	return t1.Weekday()
}
func (t MysqlTime) YearDay() int {
	if t.month == 0 || t.day == 0 {
		return 0
	}
	return calcDaynr(int(t.year), int(t.month), int(t.day)) -
		calcDaynr(int(t.year), 1, 1) + 1
}
func (t MysqlTime) YearWeek(mode int) (int, int) {
	behavior := weekMode(mode) | weekBehaviourYear
	return calcWeek(&t, behavior)
}
func (t MysqlTime) Week(mode int) int {
	if t.month == 0 || t.day == 0 {
		return 0
	}
	_, week := calcWeek(&t, weekMode(mode))
	return week
}
func (t MysqlTime) GoTime(loc *gotime.Location) (gotime.Time, error) {
	tm := gotime.Date(t.Year(), gotime.Month(t.Month()), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Microsecond()*1000, loc)
	year, month, day := tm.Date()
	hour, minute, second := tm.Clock()
	microsec := tm.Nanosecond() / 1000
	if year != t.Year() || int(month) != t.Month() || day != t.Day() ||
		hour != t.Hour() || minute != t.Minute() || second != t.Second() ||
		microsec != t.Microsecond() {
		return tm, errors.Trace(ErrInvalidTimeFormat.GenWithStackByArgs(t))
	}
	return tm, nil
}
func (t MysqlTime) IsLeapYear() bool {
	return isLeapYear(t.year)
}
func isLeapYear(year uint16) bool {
	return (year%4 == 0 && year%100 != 0) || year%400 == 0
}
var daysByMonth = [12]int{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}