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.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.ToStringおよびDateTimeOffset.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't'hh-' 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'".

適用対象

こちらもご覧ください