Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GetWeekOfYear returns wrong result?

Tags:

c#

.net

Week 1 of 2013 starts 31-12-2012 since it's a monday.

A call to GetWeekOfYear with culture nl-NL, FirstDayOfWeek.Monday and CalendarWeekRule.FirstFourDayWeek returns week number 53 for monday 31-12-2012 and week 1 for tuesday 1-1-2013. How can that monday have a different week number than tuesday?

Am i missing something?

like image 273
Jeroen Avatar asked Nov 04 '22 12:11

Jeroen


1 Answers

Because it's week 53 of 2012. It will return the week of the year passed in, based on the date you use (31-12-2012). Week 1 of 2013 is the same week as week 53 of 2012.

like image 165
Reed Copsey Avatar answered Nov 13 '22 22:11

Reed Copsey