DateTimeFormatInfo.MonthDayPattern 속성

정의

월 및 일 값에 대한 사용자 지정 서식 문자열을 가져오거나 설정합니다.

public:
 property System::String ^ MonthDayPattern { System::String ^ get(); void set(System::String ^ value); };
public string MonthDayPattern { get; set; }
member this.MonthDayPattern : string with get, set
Public Property MonthDayPattern As String

속성 값

String

월 및 일 값에 대한 사용자 지정 서식 문자열입니다.

예외

속성이 null로 설정되어 있습니다.

속성이 설정되어 있으며 DateTimeFormatInfo 개체가 읽기 전용입니다.

예제

다음 예제에서는 값을 표시 합니다 MonthDayPattern 몇 가지 문화권에 대 한 합니다.

using namespace System;
using namespace System::Globalization;
void PrintPattern( String^ myCulture )
{
   CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false );
   DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat;
   Console::WriteLine( " {0} {1}", myCulture, myDTFI->MonthDayPattern );
}

int main()
{
   
   // Displays the values of the pattern properties.
   Console::WriteLine( " CULTURE    PROPERTY VALUE" );
   PrintPattern( "en-US" );
   PrintPattern( "ja-JP" );
   PrintPattern( "fr-FR" );
}

/*
This code produces the following output.  The question marks take the place of native script characters.

CULTURE    PROPERTY VALUE
en-US     MMMM dd
ja-JP     M'?'d'?'
fr-FR     d MMMM

*/
using System;
using System.Globalization;

public class SamplesDTFI  {

   public static void Main()  {

      // Displays the values of the pattern properties.
      Console.WriteLine( " CULTURE    PROPERTY VALUE" );
      PrintPattern( "en-US" );
      PrintPattern( "ja-JP" );
      PrintPattern( "fr-FR" );
   }

   public static void PrintPattern( String myCulture )  {

      DateTimeFormatInfo myDTFI = new CultureInfo( myCulture, false ).DateTimeFormat;
      Console.WriteLine( "  {0}     {1}", myCulture, myDTFI.MonthDayPattern );
   }
}

/*
This code produces the following output.  The question marks take the place of native script characters.

 CULTURE    PROPERTY VALUE
  en-US     MMMM dd
  ja-JP     M'?'d'?'
  fr-FR     d MMMM

*/
Imports System.Globalization

Public Class SamplesDTFI

   Public Shared Sub Main()

      ' Displays the values of the pattern properties.
      Console.WriteLine(" CULTURE    PROPERTY VALUE")
      PrintPattern("en-US")
      PrintPattern("ja-JP")
      PrintPattern("fr-FR")

   End Sub

   Public Shared Sub PrintPattern(myCulture As [String])

      Dim myDTFI As DateTimeFormatInfo = New CultureInfo(myCulture, False).DateTimeFormat
      Console.WriteLine("  {0}     {1}", myCulture, myDTFI.MonthDayPattern)

   End Sub

End Class

'This code produces the following output.  The question marks take the place of native script characters.
'
' CULTURE    PROPERTY VALUE
'  en-US     MMMM dd
'  ja-JP     M'?'d'?'
'  fr-FR     d MMMM
'

설명

속성에 대 한 MonthDayPattern 호출에서 반환 되는 날짜 문자열의 문화권별 형식을 정의 DateTime.ToString 합니다 및 메서드 및 DateTimeOffset.ToString "m" 및 "M" 표준 서식 문자열을 제공 하는 복합 형식 문자열에 의해 합니다.

이 속성의 값이 변경 되는 경우 영향을 Calendar 받습니다.

날짜 구분 기호 자리 표시자를 사용하는 대신 월 및 일 패턴의 날짜 구분 기호를 정확한 문자열로 설정하는 것이 좋습니다. 예를 들어 MM-DD 패턴을 가져오려면 월 및 일 패턴을 "MM-DD"로 설정합니다.

적용 대상

추가 정보