C#获取一周的工作日显示(星期几)

代码如下:

       gridBandW1.Caption = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.DayOfWeek);
            gridBandW2.Caption = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.AddDays(1).DayOfWeek);
            gridBandW3.Caption = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.AddDays(2).DayOfWeek);
            gridBandW4.Caption = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.AddDays(3).DayOfWeek);
            gridBandW5.Caption = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.AddDays(4).DayOfWeek);
            gridBandW6.Caption = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.AddDays(5).DayOfWeek);
            gridBandW7.Caption = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.AddDays(6).DayOfWeek);

 

posted @ 2018-09-03 09:31  沙耶  阅读(1428)  评论(0编辑  收藏  举报