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

屬性值

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 由串連 LongDatePattern 以空格分隔的和屬性,即可動態產生屬性的值 LongTimePattern 。 此動態指派會在下列情況下發生:

  • 如果在明確設定屬性值之前先行抓取屬性值,則為。

  • 當屬性的值 LongDatePattern 變更時。

  • 當屬性的值 LongTimePattern 變更時。

如果屬性的值變更,這個屬性會受到影響 Calendar

適用於

另請參閱