GregorianCalendar.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를 반환합니다.

예외

era가 달력에서 지원하는 범위 밖에 있는 경우

또는

year가 달력에서 지원하는 범위 밖에 있는 경우

또는

month가 달력에서 지원하는 범위 밖에 있는 경우

예제

다음 코드 예제에서는 현재 시대에 5년 동안 모든 달에 대해 IsLeapMonth를 호출합니다.

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

   }
}

/*
This code produces the following output.

2001:           False   False   False   False   False   False   False   False   False   False   False   False
2002:           False   False   False   False   False   False   False   False   False   False   False   False
2003:           False   False   False   False   False   False   False   False   False   False   False   False
2004:           False   False   False   False   False   False   False   False   False   False   False   False
2005:           False   False   False   False   False   False   False   False   False   False   False   False

*/
using System;
using System.Globalization;

public class SamplesGregorianCalendar  {

   public static void Main()  {

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

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

/*
This code produces the following output.

2001:           False   False   False   False   False   False   False   False   False   False   False   False
2002:           False   False   False   False   False   False   False   False   False   False   False   False
2003:           False   False   False   False   False   False   False   False   False   False   False   False
2004:           False   False   False   False   False   False   False   False   False   False   False   False
2005:           False   False   False   False   False   False   False   False   False   False   False   False

*/
Imports System.Globalization

Public Class SamplesGregorianCalendar   
   
   Public Shared Sub Main()

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

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

   End Sub

End Class


'This code produces the following output.
'
'2001:           False   False   False   False   False   False   False   False   False   False   False   False
'2002:           False   False   False   False   False   False   False   False   False   False   False   False
'2003:           False   False   False   False   False   False   False   False   False   False   False   False
'2004:           False   False   False   False   False   False   False   False   False   False   False   False
'2005:           False   False   False   False   False   False   False   False   False   False   False   False

설명

그레고리오력의 윤년은 100으로 나눌 수 있는 경우를 제외하고 4로 균등하게 나눌 수 있는 연도로 정의됩니다. 그러나 400으로 나눌 수 있는 연도는 윤년입니다. 예를 들어 1900년은 윤년이 아니라 2000년이었습니다. 평년은 365일, 윤년은 366일입니다.

윤월은 윤년에만 발생하는 전체 월입니다. 그레고리오력에는 윤월이 없습니다.

적용 대상

추가 정보