Share via


DateTimeFormatInfo.UniversalSortableDateTimePattern プロパティ

"u" と "U" の形式指定文字に関連付けられた世界協定時刻の並べ替え可能な日付と時刻の値の形式パターンを取得します。

Public ReadOnly Property UniversalSortableDateTimePattern As String
[C#]
public string UniversalSortableDateTimePattern {get;}
[C++]
public: __property String* get_UniversalSortableDateTimePattern();
[JScript]
public function get UniversalSortableDateTimePattern() : String;

プロパティ値

"u" と "U" の形式指定文字に関連付けられた世界協定時刻の並べ替え可能な日付と時刻の値の形式パターン。

解説

UniversalSortableDateTimePattern を使用すると、末尾に世界協定時刻指定子 "Z" のついた並べ替え可能な形式で時刻を表示できます。この形式が並べ替え可能なのは、年、月、日、時、分、および秒に先行ゼロを使用するためです。パターン ("yyyy'-'MM'-'dd HH':'mm':'ss'Z'") は、カルチャや書式プロバイダに関係なく同じです。

使用例

[Visual Basic, C#, C++] いくつかのカルチャの UniversalSortableDateTimePattern の値を表示するコードの例を次に示します。

 
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'
'

[C#] 
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'

*/

[C++] 
#using <mscorlib.dll>
using namespace System;
using namespace System::Globalization;

void PrintPattern(String * myCulture)
{
   CultureInfo * MyCI = new CultureInfo(myCulture, false);
   DateTimeFormatInfo* myDTFI = MyCI -> DateTimeFormat;
   Console::WriteLine(S" {0} {1}", myCulture, myDTFI -> UniversalSortableDateTimePattern);
}

int main()
{
   // Displays the values of the pattern properties.
   Console::WriteLine(S" CULTURE    PROPERTY VALUE");
   PrintPattern(S"en-US");
   PrintPattern(S"ja-JP");
   PrintPattern(S"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'

*/

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

DateTimeFormatInfo クラス | DateTimeFormatInfo メンバ | System.Globalization 名前空間 | SortableDateTimePattern