获取周一还是周日作为首日

     first = DateTime.MinValue;            

last = DateTime.MinValue;

            DateTime firstDay = new DateTime(year, 1, 1);     

        int firstDayOfWeek = (int)new DateTime(year, 1, 1).DayOfWeek;           

        first = firstDay.AddDays((weeks - 1) * 7 - firstDayOfWeek + 1);      //星期一      

        last = first.AddDays(6);

                               

 

       first = firstDay.AddDays((weeks - 1) * 7 - firstDayOfWeek);        //星期天

       last = first.AddDays(6);

posted @ 2013-11-01 09:19  山之子  阅读(194)  评论(0编辑  收藏  举报