HebrewCalendar.IsLeapDay(Int32, Int32, Int32, Int32) 方法

定義

判斷指定紀元中指定的日期是否為閏日。Determines whether the specified date in the specified era is a leap day.

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

表示年份的整數。An integer that represents the year.

month
Int32

從 1 到 13 的整數,表示月份。An integer from 1 to 13 that represents the month.

day
Int32

從 1 到 30 的整數,表示日期。An integer from 1 to 30 that represents the day.

era
Int32

表示紀元的整數。An integer that represents the era. 請指定 HebrewEraHebrewCalendar.Eras[Calendar.CurrentEra]Specify either HebrewEra or HebrewCalendar.Eras[Calendar.CurrentEra].

傳回

如果指定的日期為閏日,則為 true,否則為 falsetrue if the specified day is a leap day; otherwise, false.

例外狀況

yearmonthdayera 在這個曆法所支援的範圍之外。year, month, day, or era is outside the range supported by this calendar.

範例

下列程式碼範例會針對每個紀元中的五年,在第二個月的最後一天(二月)中呼叫 IsLeapDayThe following code example calls IsLeapDay for the last day of the second month (February) for five years in each of the eras.

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)。This implementation of the HebrewCalendar class recognizes only the Hebrew years 5343 to 5999 (1583 to 2239 in the Gregorian calendar).

在每隔19年的週期中,以19個平均整除的年份為結尾,第三、第6、第3、第11、14、17和19年都是閏年。In every 19-year cycle that ends with a year that is evenly divisible by 19, the 3rd, 6th, 8th, 11th, 14th, 17th, and 19th years are leap years. 根據 Jewish 假日的位置而定,一般年份可能有353到355天的時間。A common year can have from 353 to 355 days, depending on the placement of Jewish holidays. 閏年可能會有383到385天的時間。A leap year can have from 383 to 385 days.

閏日是只在閏年發生的一天。A leap day is a day that occurs only in a leap year. 在希伯來文日曆中,Adar Alef 的最後一天和 Adar Beit 中的所有天數都會被視為閏日。In the Hebrew calendar, the last day of Adar Alef and all the days in Adar Beit are considered leap days.

適用於

另請參閱