/// <summary> /// 根据开始时间、结束时间获取这段时间内的各个月的最后一天的List /// </summary> /// <param name="startDt">开始时间</param> /// <param name="endDt">结束时间</param> /// <returns>根据开始时间、结束时间获取这段时间内的各个月的最后一天的List</returns> public List <DateTime> SplitMonth(DateTime startDt, DateTime endDt) { List <DateTime> monthes = new List <DateTime>(); //DateTime tempDT = new DateTime(endDt.Year, endDt.Month, 1); DateTime tempDT = new HrmisUtility().StartMonthByYearMonth(endDt); endDt = tempDT.AddMonths(1).AddDays(-1); do { //DateTime temp = new DateTime(startDt.Year, startDt.Month, 1); DateTime temp = new HrmisUtility().StartMonthByYearMonth(startDt); monthes.Add(temp.AddMonths(1).AddDays(-1)); startDt = startDt.AddMonths(1); } while (startDt <= endDt); return(monthes); }