HebrewCalendar.IsLeapDay(Int32, Int32, Int32, Int32) Метод

Определение

Определяет, является ли указанная дата указанной эры високосным днем.

public:
 override bool IsLeapDay(int year, int month, int day, int era);
public override bool IsLeapDay (int year, int month, int day, int era);
override this.IsLeapDay : int * int * int * int -> bool
Public Overrides Function IsLeapDay (year As Integer, month As Integer, day As Integer, era As Integer) As Boolean

Параметры

year
Int32

Целое число, представляющее год.

month
Int32

Целое число от 1 до 13, обозначающее месяц.

day
Int32

Целое число от 1 до 30, обозначающее день.

era
Int32

Целое число, представляющее эру. Укажите HebrewEra или HebrewCalendar.Eras[Calendar.CurrentEra].

Возвращаемое значение

Значение true, если указанный день — високосный; в противном случае — значение false.

Исключения

Параметры year, month, day или era находятся вне поддерживаемого диапазона значений данного календаря.

Примеры

В следующем примере кода вызывается IsLeapDay последний день второго месяца (февраль) в течение пяти лет в каждой из эпох.

using namespace System;
using namespace System::Globalization;
int main()
{
   
   // Creates and initializes a HebrewCalendar.
   HebrewCalendar^ myCal = gcnew HebrewCalendar;
   
   // Creates a holder for the last day of the second month (February).
   int iLastDay;
   
   // Displays the header.
   Console::Write( "YEAR\t" );
   for ( int y = 5761; y <= 5765; y++ )
      Console::Write( "\t {0}", y );
   Console::WriteLine();
   
   // Checks five years in the current era.
   Console::Write( "CurrentEra:" );
   for ( int y = 5761; y <= 5765; y++ )
   {
      iLastDay = myCal->GetDaysInMonth( y, 2, HebrewCalendar::CurrentEra );
      Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, HebrewCalendar::CurrentEra ) );

   }
   Console::WriteLine();
   
   // Checks five years in each of the eras.
   for ( int i = 0; i < myCal->Eras->Length; i++ )
   {
      Console::Write( "Era {0}:\t", myCal->Eras[ i ] );
      for ( int y = 5761; y <= 5765; y++ )
      {
         iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] );
         Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) );

      }
      Console::WriteLine();

   }
}

/*
This code produces the following output.

YEAR            5761    5762    5763    5764    5765
CurrentEra:     False   False   False   False   False
Era 1:          False   False   False   False   False

*/
using System;
using System.Globalization;

public class SamplesHebrewCalendar  {

   public static void Main()  {

      // Creates and initializes a HebrewCalendar.
      HebrewCalendar myCal = new HebrewCalendar();

      // Creates a holder for the last day of the second month (February).
      int iLastDay;

      // Displays the header.
      Console.Write( "YEAR\t" );
      for ( int y = 5761; y <= 5765; y++ )
         Console.Write( "\t{0}", y );
      Console.WriteLine();

      // Checks five years in the current era.
      Console.Write( "CurrentEra:" );
      for ( int y = 5761; y <= 5765; y++ )  {
         iLastDay = myCal.GetDaysInMonth( y, 2, HebrewCalendar.CurrentEra );
         Console.Write( "\t{0}", myCal.IsLeapDay( y, 2, iLastDay, HebrewCalendar.CurrentEra ) );
      }
      Console.WriteLine();

      // Checks five years in each of the eras.
      for ( int i = 0; i < myCal.Eras.Length; i++ )  {
         Console.Write( "Era {0}:\t", myCal.Eras[i] );
         for ( int y = 5761; y <= 5765; y++ )  {
            iLastDay = myCal.GetDaysInMonth( y, 2, myCal.Eras[i] );
            Console.Write( "\t{0}", myCal.IsLeapDay( y, 2, iLastDay, myCal.Eras[i] ) );
         }
         Console.WriteLine();
      }
   }
}

/*
This code produces the following output.

YEAR            5761    5762    5763    5764    5765
CurrentEra:     False   False   False   False   False
Era 1:          False   False   False   False   False

*/
Imports System.Globalization

Public Class SamplesHebrewCalendar   
   
   Public Shared Sub Main()

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

      ' Creates a holder for the last day of the second month (February).
      Dim iLastDay As Integer

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

      ' Checks five years in the current era.
      Console.Write("CurrentEra:")
      For y = 5761 To 5765
         iLastDay = myCal.GetDaysInMonth(y, 2, HebrewCalendar.CurrentEra)
         Console.Write(ControlChars.Tab + "{0}", myCal.IsLeapDay(y, 2, iLastDay, HebrewCalendar.CurrentEra))
      Next y
      Console.WriteLine()

      ' Checks five years in each of the eras.
      Dim i As Integer
      For i = 0 To myCal.Eras.Length - 1
         Console.Write("Era {0}:" + ControlChars.Tab, myCal.Eras(i))
         For y = 5761 To 5765
            iLastDay = myCal.GetDaysInMonth(y, 2, myCal.Eras(i))
            Console.Write(ControlChars.Tab + "{0}", myCal.IsLeapDay(y, 2, iLastDay, myCal.Eras(i)))
         Next y
         Console.WriteLine()
      Next i

   End Sub

End Class


'This code produces the following output.
'
'YEAR            5761    5762    5763    5764    5765
'CurrentEra:     False   False   False   False   False
'Era 1:          False   False   False   False   False

Комментарии

Эта реализация HebrewCalendar класса распознает только еврейские годы с 5343 по 5999 (от 1583 до 2239 в григорианском календаре).

В каждом 19-летнем цикле, который заканчивается годом, который равномерно делится на 19, 3-й, 6-й, 8-й, 11-й, 14-й, 17-й и 19-й годы являются високосными годами. Год может иметь от 353 до 355 дней, в зависимости от размещения еврейских праздников. Високосный год может иметь от 383 до 385 дней.

Високосный день — это день, который происходит только в високосном году. В еврейском календаре последний день Адар Алефа и все дни в Адар-Бейт считаются високосными днями.

Применяется к

См. также раздел