HebrewCalendar.IsLeapDay(Int32, Int32, Int32, Int32) Metoda

Definicja

Określa, czy określona data w określonej erze jest dniem przestępnym.

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

Parametry

year
Int32

Liczba całkowita reprezentująca rok.

month
Int32

Liczba całkowita z zakresu od 1 do 13, która reprezentuje miesiąc.

day
Int32

Liczba całkowita z zakresu od 1 do 30, która reprezentuje dzień.

era
Int32

Liczba całkowita reprezentująca erę. Określ wartość HebrewEra lub HebrewCalendar.Eras[Calendar.CurrentEra].

Zwraca

true jeśli określony dzień jest dniem przestępnym; w przeciwnym razie , false.

Wyjątki

year, month, daylub era znajduje się poza zakresem obsługiwanym przez ten kalendarz.

Przykłady

Poniższy przykład kodu wywołuje IsLeapDay ostatni dzień drugiego miesiąca (luty) przez pięć lat w każdej z epok.

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

Uwagi

Ta implementacja HebrewCalendar klasy rozpoznaje tylko hebrajskie lata od 5343 do 5999 (od 1583 do 2239 w kalendarzu gregoriańskim).

W każdym 19-letnim cyklu, który kończy się rokiem, który jest równomiernie podzielny przez 19, trzeci, 6, 8, 11, 14, 17, i 19 lat są latami przestępnymi. Wspólny rok może mieć od 353 do 355 dni, w zależności od umieszczania żydowskich świąt. Rok przestępny może mieć od 383 do 385 dni.

Dzień przestępny to dzień, który występuje tylko w roku przestępnym. W kalendarzu hebrajskim ostatni dzień Adar Alef i wszystkie dni w Adar Beit są uważane za dni przestępne.

Dotyczy

Zobacz też