Commit d52dfbda authored by chenweijian's avatar chenweijian

时间utils

parent a97b7633
...@@ -52,4 +52,9 @@ func AddDate(t time.Time, years int, months int) time.Time { ...@@ -52,4 +52,9 @@ func AddDate(t time.Time, years int, months int) time.Time {
return time.Date(year+years, month+time.Month(months), day, return time.Date(year+years, month+time.Month(months), day,
hour, min, sec, t.Nanosecond(), t.Location()) hour, min, sec, t.Nanosecond(), t.Location())
} }
\ No newline at end of file
// 当天结束剩余秒数
func DayRemainSecond(date time.Time) int64 {
return time.Date(date.Year(), date.Month(), date.Day(), 23, 59, 59, 999, date.Location()).Unix() - date.Unix()
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment