我想获得整整一周的周数,但本周应该从周一而不是周日开始。我的代码的输出是,是的,我得到全年的周数,但它从周日开始。
DateTime nicole = new DateTime();
for (int i = 1; i <= 366; i++)
{
System.Globalization.CultureInfo ci = System.Threading.Thread.CurrentThread.CurrentCulture;
Int32 weekNo = ci.Calendar.GetWeekOfYear(
new DateTime(nicole.Year,1, 1).AddDays(i-1),
ci.DateTimeFormat.CalendarWeekRule,
ci.DateTimeFormat.FirstDayOfWeek
);
datarow["Week_In_Year"] = "Week" + " " + weekNo;
}