UmAlQuraCalendar.GetDaysInYear Method (Int32, Int32)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Calculates the number of days in the specified year of the specified era.
Assembly: mscorlib (in mscorlib.dll)
'Declaration Public Overrides Function GetDaysInYear ( _ year As Integer, _ era As Integer _ ) As Integer
Parameters
- year
- Type: System.Int32
A year.
- era
- Type: System.Int32
An era. Specify UmAlQuraCalendar.Eras[UmAlQuraCalendar.CurrentEra].
Return Value
Type: System.Int32The 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 the UmAlQuraCalendar class. |
The following example calls the GetDaysInYear method to get the number of days in ten consecutive years in each era supported by the UmAlQuraCalendar class.
Imports System.Globalization Module Example Public Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock) Dim cal As New UmAlQuraCalendar() Dim currentYear As Integer = cal.GetYear(Date.Now) outputBlock.Text &= "Era Year Days" & vbCrLf outputBlock.Text &= vbCrLf For Each era As Integer In cal.Eras For year As Integer = currentYear To currentYear + 9 outputBlock.Text += String.Format("{0}{1} {2} {3}", ShowCurrentEra(cal, era), era, year, cal.GetDaysInYear(year, era)) & vbCrLf Next Next outputBlock.Text &= vbCrLf outputBlock.Text &= " * Indicates the current era." & vbCrLf End Sub Private Function ShowCurrentEra(ByVal cal As Calendar, ByVal era As Integer) As String If era = cal.Eras(Calendar.CurrentEra) Then Return "*" Else Return " " End If End Function End Module ' The example displays the following output: ' Era Year Days ' ' *1 1431 354 ' *1 1432 354 ' *1 1433 355 ' *1 1434 354 ' *1 1435 355 ' *1 1436 354 ' *1 1437 354 ' *1 1438 354 ' *1 1439 355 ' *1 1440 354 ' ' * Indicates the current era.
Show: