JapaneseCalendar.IsLeapMonth(Int32, Int32, Int32) メソッド

定義

指定した時代 (年号) の指定した年の指定した月が閏月かどうかを確認します。

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

パラメーター

year
Int32

年を表す整数。

month
Int32

月を表す 1 から 12 の整数。

era
Int32

時代 (年号) を表す整数。

戻り値

このメソッドは、派生クラスでオーバーライドされない限り、常に false を返します。

例外

year が暦でサポートされている範囲外です。

- または -

month が暦でサポートされている範囲外です。

- または -

era が暦でサポートされている範囲外です。

次の例では、現在の時代の最初の 5 年間のすべての月を呼び出 IsLeapMonth します。

using namespace System;
using namespace System::Globalization;
int main()
{
   
   // Creates and initializes a JapaneseCalendar.
   JapaneseCalendar^ myCal = gcnew JapaneseCalendar;
   
   // Checks all the months in five years in the current era.
   int iMonthsInYear;
   for ( int y = 1; y <= 5; y++ )
   {
      Console::Write( " {0}:\t", y );
      iMonthsInYear = myCal->GetMonthsInYear( y, JapaneseCalendar::CurrentEra );
      for ( int m = 1; m <= iMonthsInYear; m++ )
         Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, JapaneseCalendar::CurrentEra ) );
      Console::WriteLine();

   }
}

/*
This code produces the following output.

1:              False   False   False   False   False   False   False   False   False   False   False   False
2:              False   False   False   False   False   False   False   False   False   False   False   False
3:              False   False   False   False   False   False   False   False   False   False   False   False
4:              False   False   False   False   False   False   False   False   False   False   False   False
5:              False   False   False   False   False   False   False   False   False   False   False   False

*/
using System;
using System.Globalization;

public class SamplesJapaneseCalendar  {

   public static void Main()  {

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

      // Checks all the months in five years in the current era.
      int iMonthsInYear;
      for ( int y = 1; y <= 5; y++ )  {
         Console.Write( "{0}:\t", y );
         iMonthsInYear = myCal.GetMonthsInYear( y, JapaneseCalendar.CurrentEra );
         for ( int m = 1; m <= iMonthsInYear; m++ )
            Console.Write( "\t{0}", myCal.IsLeapMonth( y, m, JapaneseCalendar.CurrentEra ) );
         Console.WriteLine();
      }
   }
}

/*
This code produces the following output.

1:              False   False   False   False   False   False   False   False   False   False   False   False
2:              False   False   False   False   False   False   False   False   False   False   False   False
3:              False   False   False   False   False   False   False   False   False   False   False   False
4:              False   False   False   False   False   False   False   False   False   False   False   False
5:              False   False   False   False   False   False   False   False   False   False   False   False

*/
Imports System.Globalization

Public Class SamplesJapaneseCalendar   
   
   Public Shared Sub Main()

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

      ' Checks all the months in five years in the current era.
      Dim iMonthsInYear As Integer
      Dim y As Integer
      For y = 1 To 5
         Console.Write("{0}:" + ControlChars.Tab, y)
         iMonthsInYear = myCal.GetMonthsInYear(y, JapaneseCalendar.CurrentEra)
         Dim m As Integer
         For m = 1 To iMonthsInYear
            Console.Write(ControlChars.Tab + "{0}", myCal.IsLeapMonth(y, m, JapaneseCalendar.CurrentEra))
         Next m
         Console.WriteLine()
      Next y

   End Sub

End Class


'This code produces the following output.
'
'1:              False   False   False   False   False   False   False   False   False   False   False   False
'2:              False   False   False   False   False   False   False   False   False   False   False   False
'3:              False   False   False   False   False   False   False   False   False   False   False   False
'4:              False   False   False   False   False   False   False   False   False   False   False   False
'5:              False   False   False   False   False   False   False   False   False   False   False   False

注釈

和暦の閏年は、グレゴリオ暦の閏年と同じ年に対応します。 グレゴリオ暦の閏年は、100 で割り切れる場合を除き、4 で割り切れるグレゴリオ暦の年として定義されます。 ただし、400 で割り切れるグレゴリオ暦の年は閏年です。 平年は 365 日で、閏年は 366 日です。

閏月は、閏年にのみ発生する月全体です。 日本語カレンダーには閏月はありません。

適用対象

こちらもご覧ください