다음을 통해 공유


GregorianCalendar 생성자

정의

GregorianCalendar 클래스의 새 인스턴스를 초기화합니다.

오버로드

GregorianCalendar()

기본 GregorianCalendar 값을 사용하여 GregorianCalendarTypes 클래스의 새 인스턴스를 초기화합니다.

GregorianCalendar(GregorianCalendarTypes)

지정된 GregorianCalendar 값을 사용하여 GregorianCalendarTypes 클래스의 새 인스턴스를 초기화합니다.

GregorianCalendar()

Source:
GregorianCalendar.cs
Source:
GregorianCalendar.cs
Source:
GregorianCalendar.cs

기본 GregorianCalendar 값을 사용하여 GregorianCalendarTypes 클래스의 새 인스턴스를 초기화합니다.

public:
 GregorianCalendar();
public GregorianCalendar ();
Public Sub New ()

예제

다음 코드 예제에서는 를 사용하여 지역화된 를 GregorianCalendar 인쇄합니다DateTime.

using namespace System;
using namespace System::Globalization;
int main()
{
   
   // Creates and initializes three different CultureInfo.
   CultureInfo^ myCIdeDE = gcnew CultureInfo( "de-DE",false );
   CultureInfo^ myCIenUS = gcnew CultureInfo( "en-US",false );
   CultureInfo^ myCIfrFR = gcnew CultureInfo( "fr-FR",false );
   CultureInfo^ myCIruRU = gcnew CultureInfo( "ru-RU",false );
   
   // Creates a Localized GregorianCalendar.
   // GregorianCalendarTypes::Localized is the default when using the GregorianCalendar constructor with->Item[Out] parameters.
   Calendar^ myCal = gcnew GregorianCalendar;
   
   // Sets the DateTimeFormatInfo::Calendar property to a Localized GregorianCalendar.
   // Localized GregorianCalendar is the default calendar for de-DE, en-US, and fr-FR,
   myCIruRU->DateTimeFormat->Calendar = myCal;
   
   // Creates a DateTime.
   DateTime myDT = DateTime(2002,1,3,13,30,45);
   
   // Displays the DateTime.
   Console::WriteLine( "de-DE: {0}", myDT.ToString( "F", myCIdeDE ) );
   Console::WriteLine( "en-US: {0}", myDT.ToString( "F", myCIenUS ) );
   Console::WriteLine( "fr-FR: {0}", myDT.ToString( "F", myCIfrFR ) );
   Console::WriteLine( "ru-RU: {0}", myDT.ToString( "F", myCIruRU ) );
}

/*
The example displays the following output:
   de-DE: Donnerstag, 3. Januar 2002 13:30:45
   en-US: Thursday, January 03, 2002 1:30:45 PM
   fr-FR: jeudi 3 janvier 2002 13:30:45
   ru-RU: 3 января 2002 г. 13:30:45
*/
using System;
using System.Globalization;

public class SamplesGregorianCalendar  {

   public static void Main()  {

      // Creates and initializes four different CultureInfo objects.
      CultureInfo myCIdeDE = new CultureInfo("de-DE", false);
      CultureInfo myCIenUS = new CultureInfo("en-US", false);
      CultureInfo myCIfrFR = new CultureInfo("fr-FR", false);
      CultureInfo myCIruRU = new CultureInfo("ru-RU", false);

      // Creates a Localized GregorianCalendar.
      // GregorianCalendarTypes.Localized is the default when using the GregorianCalendar constructor without parameters.
      Calendar myCal = new GregorianCalendar();

      // Sets the DateTimeFormatInfo.Calendar property to a Localized GregorianCalendar.
      // Localized GregorianCalendar is the default calendar for de-DE, en-US, and fr-FR,
      myCIruRU.DateTimeFormat.Calendar = myCal;

      // Creates a DateTime.
      DateTime myDT = new DateTime( 2002, 1, 3, 13, 30, 45 );

      // Displays the DateTime.
      Console.WriteLine( "de-DE: {0}", myDT.ToString( "F", myCIdeDE ) );
      Console.WriteLine( "en-US: {0}", myDT.ToString( "F", myCIenUS ) );
      Console.WriteLine( "fr-FR: {0}", myDT.ToString( "F", myCIfrFR ) );
      Console.WriteLine( "ru-RU: {0}", myDT.ToString( "F", myCIruRU ) );
   }
}
/*
The example displays the following output:
   de-DE: Donnerstag, 3. Januar 2002 13:30:45
   en-US: Thursday, January 03, 2002 1:30:45 PM
   fr-FR: jeudi 3 janvier 2002 13:30:45
   ru-RU: 3 января 2002 г. 13:30:45
*/
Imports System.Globalization

Public Class SamplesGregorianCalendar

   Public Shared Sub Main()
      ' Creates and initializes three different CultureInfo.
      Dim myCIdeDE As New CultureInfo("de-DE", False)
      Dim myCIenUS As New CultureInfo("en-US", False)
      Dim myCIfrFR As New CultureInfo("fr-FR", False)
      Dim myCIruRU As New CultureInfo("ru-RU", False)

      ' Creates a Localized GregorianCalendar.
      ' GregorianCalendarTypes.Localized is the default when using the GregorianCalendar constructor without parameters.
      Dim myCal = New GregorianCalendar()

      ' Sets the DateTimeFormatInfo.Calendar property to a Localized GregorianCalendar.
      ' Localized GregorianCalendar is the default calendar for de-DE, en-US, and fr-FR,
      myCIruRU.DateTimeFormat.Calendar = myCal

      ' Creates a DateTime.
      Dim myDT As New DateTime(2002, 1, 3, 13, 30, 45)

      ' Displays the DateTime.
      Console.WriteLine("de-DE: {0}", myDT.ToString("F", myCIdeDE))
      Console.WriteLine("en-US: {0}", myDT.ToString("F", myCIenUS))
      Console.WriteLine("fr-FR: {0}", myDT.ToString("F", myCIfrFR))
      Console.WriteLine("ru-RU: {0}", myDT.ToString("F", myCIruRU))
   End Sub
End Class
' This example displays the following output:
'    de-DE: Donnerstag, 3. Januar 2002 13:30:45
'    en-US: Thursday, January 03, 2002 1:30:45 PM
'    fr-FR: jeudi 3 janvier 2002 13:30:45
'    ru-RU: 3 января 2002 г. 13:30:45

설명

기본값 GregorianCalendarTypes 값은 Localized합니다. 의 DateTimeFormatInfo.Calendar 속성을 CultureInfo 이 생성자로 만든 로 GregorianCalendar 설정하면 날짜와 시간은 와 연결된 언어로 CultureInfo지역화됩니다.

추가 정보

적용 대상

GregorianCalendar(GregorianCalendarTypes)

Source:
GregorianCalendar.cs
Source:
GregorianCalendar.cs
Source:
GregorianCalendar.cs

지정된 GregorianCalendar 값을 사용하여 GregorianCalendarTypes 클래스의 새 인스턴스를 초기화합니다.

public:
 GregorianCalendar(System::Globalization::GregorianCalendarTypes type);
public GregorianCalendar (System.Globalization.GregorianCalendarTypes type);
new System.Globalization.GregorianCalendar : System.Globalization.GregorianCalendarTypes -> System.Globalization.GregorianCalendar
Public Sub New (type As GregorianCalendarTypes)

매개 변수

type
GregorianCalendarTypes

만들 달력의 언어 버전을 나타내는 GregorianCalendarTypes 값입니다.

예외

typeGregorianCalendarTypes 열거형의 멤버가 아닙니다.

추가 정보

적용 대상