Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

Get week from Specific date

4.67/5 (3 votes)
22 Apr 2010CPOL 1  
DateTime date = DateTime.Now;System.Globalization.CultureInfo cult_info = System.Globalization.CultureInfo.CreateSpecificCulture(no);System.Globalization.Calendar cal = cult_info.Calendar;int weekNo = cal.GetWeekOfYear(date, cult_info.DateTimeFormat.CalendarWeekRule,...
DateTime date = DateTime.Now;

System.Globalization.CultureInfo cult_info = System.Globalization.CultureInfo.CreateSpecificCulture("no");

System.Globalization.Calendar cal = cult_info.Calendar;

int weekNo = cal.GetWeekOfYear(date, cult_info.DateTimeFormat.CalendarWeekRule, cult_info.DateTimeFormat.FirstDayOfWeek);

License

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