DateTimeFormatInfo.SortableDateTimePattern Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets the custom date and time format string for a sortable date and time value, which is associated with the "s" standard format string.

Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)

Syntax

Public ReadOnly Property SortableDateTimePattern As String
public string SortableDateTimePattern { get; }

Property Value

Type: System..::.String
The custom format string for a sortable date and time value, which is associated with the "s" standard format string.

Remarks

The custom format string returned by the SortableDateTimePattern property does not vary across different cultures.

Examples

The following example displays the value of SortableDateTimePattern for a few cultures.

Imports System.Globalization

Public Class Example
   Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
      ' Displays the values of the pattern properties.
      outputBlock.Text &= " CULTURE    PROPERTY VALUE" & vbCrLf
      PrintPattern(outputBlock, "en-US")
      PrintPattern(outputBlock, "ja-JP")
      PrintPattern(outputBlock, "fr-FR")
   End Sub

   Public Shared Sub PrintPattern(ByVal outputBlock As System.Windows.Controls.TextBlock, ByVal myCulture As [String])
      Dim myDTFI As DateTimeFormatInfo = New CultureInfo(myCulture).DateTimeFormat
      outputBlock.Text += String.Format("  {0}     {1}", myCulture, myDTFI.SortableDateTimePattern) & vbCrLf
   End Sub  
End Class 
' This example produces the following output.
'       CULTURE    PROPERTY VALUE
'        en-US     yyyy'-'MM'-'dd'T'HH':'mm':'ss
'        ja-JP     yyyy'-'MM'-'dd'T'HH':'mm':'ss
'        fr-FR     yyyy'-'MM'-'dd'T'HH':'mm':'ss
using System;
using System.Globalization;

public class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      // Displays the values of the pattern properties.
      outputBlock.Text += " CULTURE    PROPERTY VALUE" + "\n";
      PrintPattern(outputBlock, "en-US");
      PrintPattern(outputBlock, "ja-JP");
      PrintPattern(outputBlock, "fr-FR");
   }

   public static void PrintPattern(System.Windows.Controls.TextBlock outputBlock, String myCulture)
   {
      DateTimeFormatInfo myDTFI = new CultureInfo(myCulture).DateTimeFormat;
      outputBlock.Text += String.Format("  {0}     {1}", myCulture, myDTFI.SortableDateTimePattern) + "\n";
   }
}
/*
This example produces the following output.
       CULTURE    PROPERTY VALUE
        en-US     yyyy'-'MM'-'dd'T'HH':'mm':'ss
        ja-JP     yyyy'-'MM'-'dd'T'HH':'mm':'ss
        fr-FR     yyyy'-'MM'-'dd'T'HH':'mm':'ss
*/

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

DateTimeFormatInfo Class

System.Globalization Namespace

UniversalSortableDateTimePattern