Click here to Skip to main content
15,891,033 members
Articles / Programming Languages / C#

DateTime Extension Method to Give Week Number

Rate me:
Please Sign up or sign in to vote.
3.67/5 (3 votes)
19 Jul 2011CPOL2 min read 9.1K   1  
DateTime Extension method to give the right week number
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.

Views

Daily Counts

License

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


Written By
Architect Cactus Data ApS
Denmark Denmark
Microsoft MVP, Most Valuable Professional, since 2017.

It started with BASIC in the 80s, then moved to PDC Prolog, and then - when Access 1.0 was launched - "back to Basic", or rather Access Basic. Then followed VBA (Visual Basic for Applications) starting with Microsoft Access 95/97 and still going with Access 2019/365.

Still I do some VBA, but since 2008 my main focus has been C#.

Application area is mainly accounting and custom applications related to accounting.

Comments and Discussions