Question

Possible Duplicate:
Calculate week of month in .NET

I need to calculate the week number of a given Date within a month. The reason I embolden month is that all the examples (on here and elsehwere) I come across are based on yearly. Basically, I want to see what week number 14/2/2010 comes in (dd/MM/yyyy format). Given a starting day of Monday, I would expect this to return 2.

How aware of Culture do I have to be in this calculation?

Was it helpful?

Solution

This is effectively a duplicate of Get Week of Month in .NET. You need to alter the method GetWeekOfYear shown there to account for the fact that you want your weeks to start on Monday.

This answer intentionally marked Community Wiki.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top