DateTimeFormatInfo.FullDateTimePattern 属性

定义

为长日期和长时间值获取或设置自定义格式字符串。

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

属性值

长日期和时间值的自定义格式字符串。

例外

该属性设置为 null

设置了该属性,但 DateTimeFormatInfo 对象为只读。

示例

以下示例显示几个区域性的 的值 FullDateTimePattern

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->FullDateTimePattern );
}

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     dddd, MMMM dd, yyyy h:mm:ss tt
ja-JP     yyyy'年'M'月'd'日' H:mm:ss
fr-FR     dddd d MMMM yyyy HH:mm:ss

*/
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.FullDateTimePattern );
   }
}

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

 CULTURE    PROPERTY VALUE
  en-US     dddd, MMMM dd, yyyy h:mm:ss tt
  ja-JP     yyyy'年'M'月'd'日' H:mm:ss
  fr-FR     dddd d MMMM yyyy HH:mm:ss

*/
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.FullDateTimePattern)

   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     dddd, MMMM dd, yyyy h:mm:ss tt
'  ja-JP     yyyy'年'M'月'd'日' H:mm:ss
'  fr-FR     dddd d MMMM yyyy HH:mm:ss
'

注解

“F”标准格式字符串是 属性的 FullDateTimePattern 别名。 换句话说,分配给此属性的自定义格式字符串定义“F”标准格式字符串的结果字符串的格式。 有关详细信息,请参阅 标准日期和时间格式字符串

属性的值 FullDateTimePattern 是通过串联由空格分隔的 LongDatePatternLongTimePattern 属性来动态生成的。 此动态分配在以下条件下发生:

如果属性的值 Calendar 发生更改,则此属性将受到影响。

适用于

另请参阅