GregorianCalendar.GetWeekOfYear
using System;
using System.Globalization;
public class SamplesCalendar {
public static void Main() {
CultureInfo myCI = new CultureInfo("en-US");
Calendar myCal = myCI.Calendar;
CalendarWeekRule myCWR = myCI.DateTimeFormat.CalendarWeekRule;
DayOfWeek myFirstDOW = myCI.DateTimeFormat.FirstDayOfWeek;
Console.WriteLine( myCWR );
Console.WriteLine( myFirstDOW );
Console.WriteLine( myCal.GetWeekOfYear( DateTime.Now, myCWR, myFirstDOW ));
DateTime LastDay = new System.DateTime( DateTime.Now.Year, 12, 31 );
Console.WriteLine( myCal.GetWeekOfYear( LastDay, myCWR, myFirstDOW ));
Console.WriteLine( LastDay.Year );
}
}
Related examples in the same category