Click here to Skip to main content
12,505,902 members (53,706 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


1 bookmarked

DateTime extension method to give Week number

, 8 Sep 2011 CPOL
Here another approach taken from my article Time Period Library for .NET[^], which returns addditional the year of the week.// ------------------------------------------------------------------------public enum YearWeekType{ Calendar, Iso8601,} // enum YearWeekType //...


Members may post updates or alternatives to this current article in order to show different approaches or add new features.

14 Jul 2011
3 alternatives  
Strangely, the .NET DateTime does not provide a Week Number. This extension rectifies this.
6 Sep 2011
What about that :CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(pd_date, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
19 Jul 2011
Gustav Brock
There certainly is a direct method in .NET to obtain the ISO week number. However, it is buggy, as ISO week numbering has been from VB 3.0 and Access Basic (of Access 1.0) through VBA of Office 2016, and not resolved in .NET. Fortunately, a tiny test for week 53 will get it right.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Jani Giannoudis
Software Developer (Senior)
Switzerland Switzerland
Jani is Co-founder of, a free service which allows to share resources like locations, things, persons and their services in a cooperating group of people.

| | Privacy | Terms of Use | Mobile
Web02 | 2.8.160927.1 | Last Updated 8 Sep 2011
Article Copyright 2011 by Jani Giannoudis
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid