共用方式為


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 是透過串連 LongDatePattern 和屬性,以動態方式產生,並以 LongTimePattern 空格分隔。 此動態指派會在下列情況下發生:

如果屬性的值變更, Calendar 此屬性就會受到影響。

適用於

另請參閱