GetDaysInYear Method (Int32, Int32)
Collapse the table of content
Expand the table of content

HijriCalendar.GetDaysInYear Method (Int32, Int32)

 

Returns the number of days in the specified year and era.

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

Public Overrides Function GetDaysInYear (
	year As Integer,
	era As Integer
) As Integer

Parameters

year
Type: System.Int32

An integer that represents the year.

era
Type: System.Int32

An integer that represents the era.

Return Value

Type: System.Int32

The number of days in the specified year and era. The number of days is 354 in a common year or 355 in a leap year.

Exception Condition
ArgumentOutOfRangeException

year or era is outside the range supported by this calendar.

The following code example calls GetDaysInYear for five years in each era.

Imports System
Imports System.Globalization
Imports Microsoft.VisualBasic

Public Class SamplesHijriCalendar   

   Public Shared Sub Main()

      ' Creates and initializes a HijriCalendar.
      Dim myCal As New HijriCalendar()

      ' Displays the header.
      Console.Write("YEAR" + ControlChars.Tab)
      Dim y As Integer
      For y = 1421 To 1425
         Console.Write(ControlChars.Tab + "{0}", y)
      Next y
      Console.WriteLine()

      ' Displays the value of the CurrentEra property.
      Console.Write("CurrentEra:")
      For y = 1421 To 1425
         Console.Write(ControlChars.Tab + "{0}", myCal.GetDaysInYear(y, HijriCalendar.CurrentEra))
      Next y
      Console.WriteLine()

      ' Displays the values in the Eras property.
      Dim i As Integer
      For i = 0 To myCal.Eras.Length - 1
         Console.Write("Era {0}:" + ControlChars.Tab, myCal.Eras(i))
         For y = 1421 To 1425
            Console.Write(ControlChars.Tab + "{0}", myCal.GetDaysInYear(y, myCal.Eras(i)))
         Next y
         Console.WriteLine()
      Next i

   End Sub 'Main 

End Class 'SamplesHijriCalendar


'This code produces the following output. The results might vary depending on

'the settings in Regional and Language Options (or Regional Options or Regional Settings).

'

'YEAR            1421    1422    1423    1424    1425

'CurrentEra:     354     354     355     354     354

'Era 1:          354     354     355     354     354


Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2016 Microsoft