DateTimeFormatInfo.UniversalSortableDateTimePattern DateTimeFormatInfo.UniversalSortableDateTimePattern DateTimeFormatInfo.UniversalSortableDateTimePattern DateTimeFormatInfo.UniversalSortableDateTimePattern Property

定義

ISO 8601 での定義に従って、ユニバーサルで並べ替え可能な日付と時刻の文字列のカスタム書式指定文字列を取得します。Gets the custom format string for a universal, sortable date and time string, as defined by ISO 8601.

public:
 property System::String ^ UniversalSortableDateTimePattern { System::String ^ get(); };
public string UniversalSortableDateTimePattern { get; }
member this.UniversalSortableDateTimePattern : string
Public ReadOnly Property UniversalSortableDateTimePattern As String

プロパティ値

ユニバーサルで並べ替え可能な日付と時刻の文字列のカスタム書式指定文字列。The custom format string for a universal, sortable date and time string.

次の例の値を表示するUniversalSortableDateTimePatternいくつかのカルチャ。The following example displays the value of UniversalSortableDateTimePattern for a few cultures.

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

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.

CULTURE    PROPERTY VALUE
en-US     yyyy'-'MM'-'dd HH':'mm':'ss'Z'
ja-JP     yyyy'-'MM'-'dd HH':'mm':'ss'Z'
fr-FR     yyyy'-'MM'-'dd HH':'mm':'ss'Z'

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

   }

}

/*
This code produces the following output.

 CULTURE    PROPERTY VALUE
  en-US     yyyy'-'MM'-'dd HH':'mm':'ss'Z'
  ja-JP     yyyy'-'MM'-'dd HH':'mm':'ss'Z'
  fr-FR     yyyy'-'MM'-'dd HH':'mm':'ss'Z'

*/
Imports System
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 'Main

   Public Shared Sub PrintPattern(myCulture As [String])

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

   End Sub 'PrintPattern 

End Class 'SamplesDTFI

'This code produces the following output.
'
' CULTURE    PROPERTY VALUE
'  en-US     yyyy'-'MM'-'dd HH':'mm':'ss'Z'
'  ja-JP     yyyy'-'MM'-'dd HH':'mm':'ss'Z'
'  fr-FR     yyyy'-'MM'-'dd HH':'mm':'ss'Z'
'

注釈

UniversalSortableDateTimePatternプロパティへの呼び出しによって返される日付文字列の書式を定義する、DateTime.ToStringDateTimeOffset.ToStringメソッドによって複合書式指定文字列を使用するが、"u"標準書式指定文字列を指定するとします。The UniversalSortableDateTimePattern property defines the format of date strings that are returned by calls to the DateTime.ToString and DateTimeOffset.ToString methods and by composite format strings that are supplied the "u" standard format string. 最後に時刻指定子"Z"の並べ替え可能な順序で日付と時刻を表示することに使用できます。It can be used to display dates and times in a sortable order with the universal time designator "Z" at the end. 形式は、年、月、日、時間、分、および秒に先行ゼロを使用しているために、並べ替え可能です。The format is sortable because it uses leading zeros for year, month, day, hour, minute, and second. カスタム書式指定文字列 ("yyyy '-'MM'-' dd HH': 'mm': 'ss' z'") のカルチャまたは書式プロバイダーに関係なく同じです。The custom format string ("yyyy'-'MM'-'dd HH':'mm':'ss'Z'") is the same regardless of culture or format provider.

によって返される形式の文字列、UniversalSortableDateTimePatternプロパティが定義済みの標準を反映し、プロパティは読み取り専用です。The format string returned by the UniversalSortableDateTimePattern property reflects a defined standard, and the property is read-only. そのため、これは常に、カルチャに関係なく同じです。Therefore, it is always the same, regardless of the culture. カスタム書式指定文字列は、"yyyy'-'MM'-'dd HH':'mm':'ss'Z'" です。The custom format string is "yyyy'-'MM'-'dd HH':'mm':'ss'Z'".

適用対象

こちらもご覧ください