How To Get The Week Of The Year By Using A Custom First Day Of The Week Value



TODO:

Have  you ever wanted to get the week of the year by using a a custom first day of the week?

 

SOLUTION:

var weekOfYear = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(
                DateTime.Now,
                CalendarWeekRule.FirstDay,
                DayOfWeek.Monday);


NOTES:

This sample will get the week of the year by using the FirstDay of the week set to Monday, rather than the default of Sunday.



Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading