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. 指定 HebrewEra 或 HebrewCalendar.Eras[Calendar.CurrentEra]。Specify either HebrewEra or HebrewCalendar.Eras[Calendar.CurrentEra].
返回
如果指定的日期是闰日,则为 true;否则为 false。true if the specified day is a leap day; otherwise, false.
例外
year、month、day 或 era 超出了此日历支持的范围。year, month, day, or era is outside the range supported by this calendar.
示例
下面的代码示例将在 IsLeapDay 第二个月的最后一天 (2 月) ,每个纪元5年。The 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年循环中,第三、第六、第8、第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. 一年的时间可能为353到355天,具体取决于 Jewish 假日的位置。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.