1 Star 0 Fork 0

姚大鹅 / server-lib-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
time_util.go 397 Bytes
一键复制 编辑 原始数据 按行查看 历史
姚大鹅 提交于 2023-02-21 16:10 . 初始导入
package utils
import "time"
// TimeLastDay 获取指定日期当月最后一天(可当作当月最大天数)
func TimeLastDay(date time.Time) int {
currentYear, currentMonth, _ := date.Date()
currentLocation := date.Location()
firstOfMonth := time.Date(currentYear, currentMonth, 1, 0, 0, 0, 0, currentLocation)
lastOfMonth := firstOfMonth.AddDate(0, 1, -1)
return lastOfMonth.Day()
}
Go
1
https://gitee.com/yaodae/server-lib-go.git
git@gitee.com:yaodae/server-lib-go.git
yaodae
server-lib-go
server-lib-go
72061718fa99

搜索帮助