Quoted from: https://msdn.microsoft.com/en-us/library/dd318131(v=vs.85).aspx
The application can use the following elements to construct a format picture string. If spaces are used to separate the elements in the format string, these spaces appear in the same location in the output string. The letters must be in uppercase or lowercase as shown, for example, "ss", not "SS". Characters in the format string that are enclosed in single quotation marks appear in the same location and unchanged in the output string.
Picture | Meaning |
---|---|
h | Hours with no leading zero for single-digit hours; 12-hour clock |
hh | Hours with leading zero for single-digit hours; 12-hour clock |
H | Hours with no leading zero for single-digit hours; 24-hour clock |
HH | Hours with leading zero for single-digit hours; 24-hour clock |
m | Minutes with no leading zero for single-digit minutes |
mm | Minutes with leading zero for single-digit minutes |
s | Seconds with no leading zero for single-digit seconds |
ss | Seconds with leading zero for single-digit seconds |
t | One character time marker string, such as A or P |
tt | Multi-character time marker string, such as AM or PM |
For example, to get the time string
"11:29:40 PM"
the application should use the picture string
"hh':'mm':'ss tt"