Click here to Skip to main content
11,629,614 members (68,600 online)
Click here to Skip to main content

Tagged as

DateTime extension method to give Week number

, 8 Sep 2011 CPOL 3.8K 1
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 //...

Alternatives

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

14 Jul 2011
OriginalGriff
3 alternatives  
Strangely, the .NET DateTime does not provide a Week Number. This extension rectifies this.
6 Sep 2011
Bib34770
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.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...

License

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

Share

About the Author

Jani Giannoudis
Software Developer (Senior)
Switzerland Switzerland
Jani is Co-founder of Meerazo.com, 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
Web04 | 2.8.150723.1 | Last Updated 8 Sep 2011
Article Copyright 2011 by Jani Giannoudis
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid