Mega Code Archive

 
Categories / C# Tutorial / Date Time
 

Gets the Calendar instance associated with a CultureInfo

using System; using System.Globalization; public class SamplesCalendar  {    public static void Main()  {       // Gets the Calendar instance associated with a CultureInfo.       CultureInfo myCI = new CultureInfo("en-US");       Calendar myCal = myCI.Calendar;       // Gets the DTFI properties required by GetWeekOfYear.       CalendarWeekRule myCWR = myCI.DateTimeFormat.CalendarWeekRule;       DayOfWeek myFirstDOW = myCI.DateTimeFormat.FirstDayOfWeek;    } }