次の方法で共有


ThaiBuddhistCalendar.IsLeapDay メソッド

指定した日が閏日かどうかを確認します。

オーバーロードの一覧

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

.NET Compact Framework でもサポート。

[Visual Basic] Overloads Overrides Public Function IsLeapDay(Integer, Integer, Integer, Integer) As Boolean

[C#] public override bool IsLeapDay(int, int, int, int);

[C++] public: bool IsLeapDay(int, int, int, int);

[JScript] public override function IsLeapDay(int, int, int, int) : Boolean;

Calendar から継承されます。

.NET Compact Framework でもサポート。

[Visual Basic] Overloads Public Overridable Function IsLeapDay(Integer, Integer, Integer) As Boolean

[C#] public virtual bool IsLeapDay(int, int, int);

[C++] public: virtual bool IsLeapDay(int, int, int);

[JScript] public function IsLeapDay(int, int, int) : Boolean;

使用例

[Visual Basic, C#, C++] 各時代 (年号) の 5 年ごとの 2 番目の月 (2 月) の最後の日の IsLeapDay を呼び出す例を次に示します。

[Visual Basic, C#, C++] メモ   ここでは、IsLeapDay のオーバーロード形式のうちの 1 つだけについて、使用例を示します。その他の例については、各オーバーロード形式のトピックを参照してください。

 
Imports System
Imports System.Globalization
Imports Microsoft.VisualBasic

Public Class SamplesThaiBuddhistCalendar   
   
   Public Shared Sub Main()

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

      ' 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 = 2544 To 2548
         Console.Write(ControlChars.Tab + "{0}", y)
      Next y
      Console.WriteLine()

      ' Checks five years in the current era.
      Console.Write("CurrentEra:")
      For y = 2544 To 2548
         iLastDay = myCal.GetDaysInMonth(y, 2, ThaiBuddhistCalendar.CurrentEra)
         Console.Write(ControlChars.Tab + "{0}", myCal.IsLeapDay(y, 2, iLastDay, ThaiBuddhistCalendar.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 = 2544 To 2548
            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 'Main 

End Class 'SamplesThaiBuddhistCalendar


'This code produces the following output.

'

'YEAR            2544    2545    2546    2547    2548

'CurrentEra:     False   False   False   True    False

'Era 1:          False   False   False   True    False



[C#] 
using System;
using System.Globalization;


public class SamplesThaiBuddhistCalendar  {

   public static void Main()  {

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

      // Creates a holder for the last day of the second month (February).
      int iLastDay;

      // Displays the header.
      Console.Write( "YEAR\t" );
      for ( int y = 2544; y <= 2548; y++ )
         Console.Write( "\t{0}", y );
      Console.WriteLine();

      // Checks five years in the current era.
      Console.Write( "CurrentEra:" );
      for ( int y = 2544; y <= 2548; y++ )  {
         iLastDay = myCal.GetDaysInMonth( y, 2, ThaiBuddhistCalendar.CurrentEra );
         Console.Write( "\t{0}", myCal.IsLeapDay( y, 2, iLastDay, ThaiBuddhistCalendar.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 = 2544; y <= 2548; 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            2544    2545    2546    2547    2548
CurrentEra:     False   False   False   True    False
Era 1:          False   False   False   True    False

*/

[C++] 
#using <mscorlib.dll>
using namespace System;
using namespace System::Globalization;

int main()
{
   // Creates and initializes a ThaiBuddhistCalendar.
   ThaiBuddhistCalendar* myCal = new ThaiBuddhistCalendar();

   // Creates a holder for the last day of the second month (February).
   int iLastDay;

   // Displays the header.
   Console::Write(S"YEAR\t");
   for (int y = 2544; y <= 2548; y++)
      Console::Write(S"\t {0}", __box(y));
   Console::WriteLine();

   // Checks five years in the current era.
   Console::Write(S"CurrentEra:");
   for (int y = 2544; y <= 2548; y++)
   {
      iLastDay = myCal -> GetDaysInMonth(y, 2, ThaiBuddhistCalendar::CurrentEra);
      Console::Write(S"\t {0}", 
         __box(myCal -> IsLeapDay(y, 2, iLastDay, ThaiBuddhistCalendar::CurrentEra)));
   }
   Console::WriteLine();

   // Checks five years in each of the eras.
   for (int i = 0; i < myCal -> Eras -> Length; i++)
   {
      Console::Write(S"Era {0}:\t", __box(myCal -> Eras[i]));
      for (int y = 2544; y <= 2548; y++) {
         iLastDay = myCal -> GetDaysInMonth(y, 2, myCal -> Eras[i]);
         Console::Write(S"\t {0}", 
            __box(myCal -> IsLeapDay(y, 2, iLastDay, myCal -> Eras[i])));
      }
      Console::WriteLine();
   }
}

/*
This code produces the following output.

YEAR            2544    2545    2546    2547    2548
CurrentEra:     False   False   False   True    False
Era 1:          False   False   False   True    False

*/

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

参照

ThaiBuddhistCalendar クラス | ThaiBuddhistCalendar メンバ | System.Globalization 名前空間