Pointer to the Unicode string that defines the format of the time and date display. If pbstrFormat is NULL, the function uses the default format of the specified locale.
Use the following elements to construct a time format string:
- h
- The one- or two-digit hour in 12-hour format.
- hh
- The two-digit hour in 12-hour format. Single-digit values are preceded by a zero.
- H
- The one- or two-digit hour in 24-hour format.
- HH
- The two-digit hour in 24-hour format. Single-digit values are preceded by a zero.
- m
- The one- or two-digit minute.
- mm
- The two-digit minute. Single-digit values are preceded by a zero.
- s
- The one- or two-digit second.
- ss
- The two-digit second. Single-digit values are preceded by a zero.
- t
- The one-letter AM/PM abbreviation; that is, “AM” is displayed as “A.”
- tt
- The two-letter AM/PM abbreviation.
Use the following elements to construct a date format string:
- d
- The one- or two-digit day.
- dd
- The two-digit day. Single-digit values are preceded by a zero.
- ddd
- The three-character weekday abbreviation. The function uses the LOCALE_SABBREVDAYNAME value associated with the specified locale.
- dddd
- The full weekday name. The function uses the LOCALE_SDAYNAME value associated with the specified locale.
- M
- The one- or two-digit month number.
- MM
- The two-digit month number. Single-digit values are preceded by a zero.
- MMM
- The three-character abbreviation. The function uses the LOCALE_SABBREVMONTHNAME value associated with the specified locale.
- MMMM
- The full month name. The function uses the LOCALE_SMONTHNAME value associated with the specified locale.
- y
- The year is displayed as the last two digits, but with no leading zero for years less than 10.
- yy
- The last two digits of the year; that is, 1996 is displayed as “96.”
- yyyy
- The full year; that is, 1996 is displayed as “1996.”
- gg
- Period/era string. The function uses the CAL_SERASTRING value associated with the specified locale. This element is ignored if the date to be formatted does not have an associated era or period string.
For example, to get the time display
“11:29:40 PM”
use the following format string:
"hh':'mm':'ss tt"
To get the date display
“Wed, Aug 31 94”
use the following format string:
"ddd',' MMM dd yy"
If you use spaces to separate the elements, they appear in the same location in the output string. The letters must be in uppercase or lowercase as shown, for example, “ss”, not “SS.” To have a character appear in the actual time string, enclose it in single quotes and it appears in the same location as it occupies in the format string.