日期:2014-05-18 浏览次数:20940 次
#region 获取日期 /// <summary> /// 获取日期 /// </summary> /// <param name="dt1"></param> /// <param name="dt2"></param> /// <returns></returns> public static TimeContactList GetDateDepart(DateTime dt1, DateTime dt2) { Dictionary<int, string> myDic = new Dictionary<int, string>(); myDic.Add(1, "一"); myDic.Add(2, "二"); myDic.Add(3, "三"); myDic.Add(4, "四"); myDic.Add(5, "五"); myDic.Add(6, "六"); myDic.Add(7, "七"); myDic.Add(8, "八"); myDic.Add(9, "九"); myDic.Add(10, "十"); myDic.Add(11, "十一"); myDic.Add(12, "十二"); TimeContactList timeContactList = new TimeContactList(); for (DateTime time1 = dt1; time1 <= dt2; time1 = time1.AddMonths(3)) { TimeContact timeContact = new TimeContact(); timeContact.Name = "第" + myDic[(time1.AddMonths(3).AddDays(-1).Month) / 3] + "季度"; timeContact.StartTime = time1.ToString("yyyy-MM-dd"); timeContact.EndTime = time1.AddMonths(3).AddDays(-1).ToString("yyyy-MM-dd"); timeContact.StartTimeEndTime = time1.ToString("yyyy-MM-dd") + "," + time1.AddMonths(3).AddDays(-1).ToString("yyyy-MM-dd"); timeContactList.Add(timeContact); } return timeContactList; } #endregion