float week = (DateTime.IsLeapYear(year) ? 366 : 365) / 7
int year = 2004; DateTime dt = new DateTime(year, 12, 31); int week = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear( dt, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
private double CountNoOfWeeks(int year) { DateTime date1 = new DateTime(year, 1, 1); DateTime date2 = date1.AddYears(1); double weeks = (date2 - date1).TotalDays / 7; return weeks; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)