最土的办法,就是模拟:
func calc_work_day(begin, end time.Time) int { var workDay = 0 var curTime = begin for { if curTime.After(end) { break } if curTime.Weekday() == time.Saturday || curTime.Weekday() == time.Sunday { // skip } else { workDay++ } curTime = curTime.Add(time.Hour * 24) } return workDay }