DateTimeFormatInfo.UniversalSortableDateTimePattern Propriedade

Definição

Obtém a cadeia de caracteres de formato personalizado para um valor de data e hora classificável e universal, conforme definido por 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

Valor da propriedade

String

O formato personalizado para um valor de data e hora classificável e universal.The custom format string for a universal, sortable date and time string.

Exemplos

O exemplo a seguir exibe o valor de UniversalSortableDateTimePattern para algumas culturas.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

   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

End Class

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

Comentários

A UniversalSortableDateTimePattern propriedade define o formato das cadeias de caracteres de data que são retornadas por chamadas para os DateTime.ToString DateTimeOffset.ToString métodos e e por cadeias de caracteres de formato composto que são fornecidas a cadeia de formato padrão "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. Ele pode ser usado para exibir datas e horas em uma ordem classificável com o designador de tempo Universal "Z" no final.It can be used to display dates and times in a sortable order with the universal time designator "Z" at the end. O formato é classificável porque usa zeros à esquerda para ano, mês, dia, hora, minuto e segundo.The format is sortable because it uses leading zeros for year, month, day, hour, minute, and second. A cadeia de caracteres de formato personalizado ("yyyy'-'MM'-'dd HH ': ' mm ': ' ss'Z '") é a mesma, independentemente do provedor de cultura ou formato.The custom format string ("yyyy'-'MM'-'dd HH':'mm':'ss'Z'") is the same regardless of culture or format provider.

A cadeia de caracteres de formato retornada pela UniversalSortableDateTimePattern propriedade reflete um padrão definido e a propriedade é somente leitura.The format string returned by the UniversalSortableDateTimePattern property reflects a defined standard, and the property is read-only. Portanto, é sempre o mesmo, independentemente da cultura.Therefore, it is always the same, regardless of the culture. A cadeia de caracteres de formato personalizado é "aaaa'-'MM'-'dd HH':'mm':'ss'Z'".The custom format string is "yyyy'-'MM'-'dd HH':'mm':'ss'Z'".

Aplica-se a

Confira também