This documentation is archived and is not being maintained.

UmAlQuraCalendar.GetMonth Method

Calculates the month in which a specified date occurs.

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)

public override int GetMonth(
	DateTime time


Type: System.DateTime
The date value to read. The UmAlQuraCalendar class supports only dates from 04/30/1900 00.00.00 (Gregorian date) through 05/13/2029 23:59:59 (Gregorian date).

Return Value

Type: System.Int32
An integer from 1 through 12 that represents the month in the date specified by the time parameter.


time is outside the range supported by this calendar.

The following example displays the date ranges supported by the UmAlQuraCalendar class in both the Gregorian and Um Al Qura calendars. The GetMonth method is used to retrieve the month of the minimum and maximum supported dates in the Um Al Qura calendar if it is not the current culture's current calendar.

using System;
using System.Globalization;

public class Example
   public static void Main()
      Calendar cal = new UmAlQuraCalendar();
      DateTime minDate = cal.MinSupportedDateTime;
      DateTime maxDate = cal.MaxSupportedDateTime;

      Console.WriteLine("Range of the Um Al Qura calendar:");
      // Is UmAlQuraCalendar the current calendar?
      if (DateTimeFormatInfo.CurrentInfo.Calendar.ToString().Contains("UmAlQura")) {
         Calendar greg = new GregorianCalendar();
         Console.WriteLine("   Minimum: {0:d2}/{1:d2}/{2:d4} {3:HH:mm:ss} Gregorian, {3:MM/dd/yyyy HH:mm:ss} Um Al Qura",
                           greg.GetMonth(minDate), greg.GetDayOfMonth(minDate),
                           greg.GetYear(minDate), minDate);
         Console.WriteLine("   Maximum: {0:d2}/{1:d2}/{2:d4} {3:HH:mm:ss} Gregorian, {3:MM/dd/yyyy HH:mm:ss} Um Al Qura",
                           greg.GetMonth(maxDate), greg.GetDayOfMonth(maxDate),
                           greg.GetYear(maxDate), maxDate);
      // Is Gregorian the current calendar?
      else if (DateTimeFormatInfo.CurrentInfo.Calendar.ToString().Contains("Gregorian")) {         
         Console.WriteLine("   Minimum: {0:d} {0:HH:mm:ss} Gregorian, {1:d2}/{2:d2}/{3:d4} {0:HH:mm:ss} Um Al Qura",
                           minDate, cal.GetMonth(minDate), cal.GetDayOfMonth(minDate),
         Console.WriteLine("   Maximum: {0:d} {0:HH:mm:ss} Gregorian, {1:d2}/{2:d2}/{3:d4} {0:HH:mm:ss} Um Al Qura",
                           maxDate, cal.GetMonth(maxDate), cal.GetDayOfMonth(maxDate),
      // Display ranges if some other calendar is current.
      else {
         GregorianCalendar greg = new GregorianCalendar();          
         Console.WriteLine("   Minimum: {1:d2}/{2:d2}/{3:d4} {0:HH:mm:ss} " + 
                           "Gregorian, {4:d2}/{5:d2}/{6:d4} {0:HH:mm:ss} Um Al Qura",
                           minDate, greg.GetMonth(minDate), greg.GetDayOfMonth(minDate), 
                           greg.GetYear(minDate), cal.GetMonth(minDate), cal.GetDayOfMonth(minDate),
         Console.WriteLine("   Maximum: {1:d2}/{2:d2}/{3:d4} {0:HH:mm:ss} " + 
                           "Gregorian, {4:d2}/{5:d2}/{6:d4} {0:HH:mm:ss} Um Al Qura",
                           maxDate, greg.GetMonth(maxDate), greg.GetDayOfMonth(maxDate), 
                           greg.GetYear(maxDate), cal.GetMonth(maxDate), cal.GetDayOfMonth(maxDate),
// The example displays output similar to the following:
//    Range of the Um Al Qura calendar:
//       Minimum: 4/30/1900 00:00:00 Gregorian, 01/01/1318 00:00:00 Um Al Qura
//       Maximum: 5/13/2029 23:59:59 Gregorian, 12/29/1450 23:59:59 Um Al Qura

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.