Hour, Minute, and Second Format Pictures

This topic describes the format types for strings used to compose the format picture for a time string. Each format picture consists of a combination of one string of each of the format types.

Note

In the format types, the letters "m", "s", and "t" must be lowercase, and the letter "h" must be lowercase to denote the 12-hour clock or uppercase ("H") to denote the 24-hour clock.

 

The following table defines the format types used to represent hours.

String Meaning
h Hours without leading zeros for single-digit hours (12-hour clock).
hh Hours with leading zeros for single-digit hours (12-hour clock).
H Hours without leading zeros for single-digit hours (24-hour clock).
HH Hours with leading zeros for single-digit hours (24-hour clock).

 

The following table defines the format types used to represent minutes.

String Meaning
m Minutes without leading zeros for single-digit minutes.
mm Minutes with leading zeros for single-digit minutes.

 

The following table defines the format types used to represent seconds.

String Meaning
s Seconds without leading zeros for single-digit seconds.
ss Seconds with leading zeros for single-digit seconds.

 

The following table defines the format types used to represent a time marker.

String Meaning
t One-character time marker string.
[!Note]
You are recommended not to use this format for certain languages, for example, Japanese (Japan). With this format, an application always takes the first character from the time marker string, defined by LOCALE_S1159 (AM) and LOCALE_S2359 (PM). Because of this, the application can create incorrect formatting with the same string used for both AM and PM.

tt Multi-character time marker string.