Click here to Skip to main content
11,702,396 members (73,371 online)
Click here to Skip to main content
Alternatives (3)

Tagged as

DateTime Extension Method to Give Week Number

, 14 Jul 2011 CPOL 26.8K 5
Strangely, the .NET DateTime does not provide a Week Number. This extension rectifies this.


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

6 Sep 2011
What about that :CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(pd_date, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
8 Sep 2011
Jani Giannoudis
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 //...
19 Jul 2011
Gustav Brock
There certainly is a direct method in .NET to obtain the ISO week number.It is even quite simple; it is, however, buggy - as ISO week numbering "always" has been at MSFT since VB 3.0 and Access Basic (of Access 2.0) and through all versions up to and including VBA of Office 2010. It is a big...


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


About the Author

Wales Wales
Born at an early age, he grew older. At the same time, his hair grew longer, and was tied up behind his head.
Has problems spelling the word "the".
Invented the portable cat-flap.
Currently, has not died yet. Or has he?

| | Privacy | Terms of Use | Mobile
Web02 | 2.8.150819.1 | Last Updated 15 Jul 2011
Article Copyright 2011 by OriginalGriff
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid