Jeroen
Jeroen

Reputation: 4023

GetWeekOfYear returns wrong result?

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?

Upvotes: 5

Views: 1619

Answers (2)

Reed Copsey
Reed Copsey

Reputation: 564831

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.

Upvotes: 2

Andrew Barber
Andrew Barber

Reputation: 40160

The year you have passed in your first example is 2012. Not 2013. It's returning the week of the year you have passed in your date.

Upvotes: 0

Related Questions