GregorianCalendar.GetWeekOfYear : GregorianCalendar « Date Time « C# / C Sharp






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

1.GregorianCalendar Class
2.GregorianCalendar Constructor
3.GregorianCalendar.AddMonths
4.GregorianCalendar.GetDayOfMonth
5.GregorianCalendar.GetDaysInMonth
6.GregorianCalendar.GetDaysInYear
7.GregorianCalendar.GetMonthsInYear
8.GregorianCalendar.IsLeapDay
9.GregorianCalendar.IsLeapMonth
10.GregorianCalendar.IsLeapYear
11.GregorianCalendar.MaxSupportedDateTime
12.GregorianCalendarTypes Enumeration