HebrewCalendar.IsLeapDay(Int32, Int32, Int32, Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
确定指定纪元中的指定日期是否为闰日。
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 之间的一个整数,用于表示月中日期。
返回
如果指定的日期是闰日,则为 true
;否则为 false
。
例外
year
、month
、day
或 era
超出了此日历支持的范围。
示例
下面的代码示例调用 IsLeapDay
每个时期 (年 2 月) 第二个月的最后一天,持续五年。
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 天。
闰日是仅在闰年发生的一天。 在希伯来历中,阿达尔·阿莱夫的最后一天和阿达尔·贝特的所有日子都被视为闰日。