private int GetWeek(DateTime now)
{
System.Globalization.GregorianCalendar gc = new System.Globalization.GregorianCalendar();
int weekOfYear = gc.GetWeekOfYear(now, System.Globalization.CalendarWeekRule.FirstDay, DayOfWeek.Sunday);
return weekOfYear;
}
C#:GetWeek(GetWeek(DateTime.Now))
对应
SQL:SELECT DATEPART(WEEK,GETDATE())