IASClock::put_LabelFormat

This method sets the current label format.

Syntax

HRESULT put_LabelFormat( BOOL fTime, BSTR bstrFormat, LONG FormatFlags );

Parameters

fTime
Boolean that is set to TRUE for the time, or to FALSE for the date.
bstrFormat
Unicode string that defines the format of the time and date display. If bstrFormat 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.

FormatFlags
Bitmask of flags specifying the format.

The following formats are available for time display:

LOCALE_NOUSEROVERRIDE
If set, the function formats the string using the system default time format for the specified locale. If not set, the function formats the string using any user overrides to the locale’s default time format. This flag cannot be set if bstrFormat is non-NULL.
TIME_NOMINUTESORSECONDS
Do not use minutes or seconds.
TIME_NOSECONDS
Do not use seconds.
TIME_NOTIMEMARKER
Do not use a time marker.
TIME_FORCE24HOURFORMAT
Always use a 24-hour time format.

The following formats are available for date display:

LOCALE_NOUSEROVERRIDE
If set, the function formats the string using the system default date format for the specified locale. If not set, the function formats the string using any user overrides to the locale’s default date format.
DATE_SHORTDATE
Use the short date format. This is the default. Cannot be used with DATE_LONGDATE.
DATE_LONGDATE
Use the long date format. Cannot be used with DATE_SHORTDATE.
DATE_USE_ALT_CALENDAR
Use the alternate calendar, if one exists, to format the date string. If this flag is set, the function uses the default format for that alternate calendar, rather than using any user overrides. The user overrides are used only in the event that there is no default format for the specified alternate calendar.

Return Values

NOERROR indicates success. E_INVALIDARG indicates that the argument is invalid.