KoreanCalendar.IsLeapDay(Int32, Int32, Int32, Int32) Metode

Definisi

Menentukan apakah tanggal yang ditentukan dalam era yang ditentukan adalah hari lompatan.

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

Parameter

year
Int32

Bilangan bulat yang mewakili tahun.

month
Int32

Bilangan bulat dari 1 hingga 12 yang mewakili bulan tersebut.

day
Int32

Bilangan bulat dari 1 hingga 31 yang mewakili hari tersebut.

era
Int32

Bilangan bulat yang mewakili era.

Mengembalikan

true jika hari yang ditentukan adalah hari lompatan; jika tidak, false.

Pengecualian

year berada di luar rentang yang didukung oleh kalender.

-atau-

month berada di luar rentang yang didukung oleh kalender.

-atau-

day berada di luar rentang yang didukung oleh kalender.

-atau-

era berada di luar rentang yang didukung oleh kalender.

Contoh

Contoh berikut memanggil IsLeapDay hari terakhir bulan kedua (Februari) selama lima tahun di setiap era.

using namespace System;
using namespace System::Globalization;
int main()
{
   
   // Creates and initializes a KoreanCalendar.
   KoreanCalendar^ myCal = gcnew KoreanCalendar;
   
   // Creates a holder for the last day of the second month (February).
   int iLastDay;
   
   // Displays the header.
   Console::Write( "YEAR\t" );
   for ( int y = 4334; y <= 4338; y++ )
      Console::Write( "\t {0}", y );
   Console::WriteLine();
   
   // Checks five years in the current era.
   Console::Write( "CurrentEra:" );
   for ( int y = 4334; y <= 4338; y++ )
   {
      iLastDay = myCal->GetDaysInMonth( y, 2, KoreanCalendar::CurrentEra );
      Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, KoreanCalendar::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 = 4334; y <= 4338; 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            4334    4335    4336    4337    4338
CurrentEra:     False   False   False   True    False
Era 1:          False   False   False   True    False

*/
using System;
using System.Globalization;

public class SamplesKoreanCalendar  {

   public static void Main()  {

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

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

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

      // Checks five years in the current era.
      Console.Write( "CurrentEra:" );
      for ( int y = 4334; y <= 4338; y++ )  {
         iLastDay = myCal.GetDaysInMonth( y, 2, KoreanCalendar.CurrentEra );
         Console.Write( "\t{0}", myCal.IsLeapDay( y, 2, iLastDay, KoreanCalendar.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 = 4334; y <= 4338; 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            4334    4335    4336    4337    4338
CurrentEra:     False   False   False   True    False
Era 1:          False   False   False   True    False

*/
Imports System.Globalization

Public Class SamplesKoreanCalendar   
   
   Public Shared Sub Main()

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

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

      ' Checks five years in the current era.
      Console.Write("CurrentEra:")
      For y = 4334 To 4338
         iLastDay = myCal.GetDaysInMonth(y, 2, KoreanCalendar.CurrentEra)
         Console.Write(ControlChars.Tab + "{0}", myCal.IsLeapDay(y, 2, iLastDay, KoreanCalendar.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 = 4334 To 4338
            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            4334    4335    4336    4337    4338
'CurrentEra:     False   False   False   True    False
'Era 1:          False   False   False   True    False

Keterangan

Tahun lompatan di kalender Korea sesuai dengan tahun lompatan yang sama di kalender Gregorian. Tahun kabut dalam kalender Gregorian didefinisikan sebagai tahun Gregorian yang dapat dibagi secara merata oleh empat, kecuali jika dibagi dengan 100. Namun, tahun-tahun Gregorian yang terbagi oleh 400 adalah tahun kampung. Tahun umum memiliki 365 hari dan tahun kampung memiliki 366 hari.

Hari lompatan adalah hari yang hanya terjadi pada tahun kampung. Misalnya, hari ke-29 Februari adalah satu-satunya hari kampung.

Berlaku untuk

Lihat juga