Windows Dev Center

DateTimeFormatInfo.ShortTimePattern Property

Gets or sets the custom date and time format string for a short time value, which is associated with the "t" standard format string.

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

'Declaration
Public Property ShortTimePattern As String

Property Value

Type: System.String
The custom format string for a short time value, which is associated with the "t" standard format string.

ExceptionCondition
ArgumentNullException

An attempt was made to set the property to Nothing.

InvalidOperationException

The DateTimeFormatInfo object is read-only.

Version Notes

Windows Phone

 DateTimeFormatInfo.ShortTimePattern values do not change when the clock is set to 24 hours. The property values should become "h:mm" but remain "h:mm tt" where tt is AM or PM.

The following example displays the value of ShortTimePattern 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.ShortTimePattern) & vbCrLf
   End Sub  
End Class 
' This example  produces the following output.
'       CULTURE    PROPERTY VALUE
'        en-US     h:mm tt
'        ja-JP     H:mm
'        fr-FR     HH:mm


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2015 Microsoft