Partager via


Day, Month, Year, and Era Format Pictures (Compact 7)

3/12/2014

You can use the following elements to create a null-terminated format picture string, which specifies the format the date, month, year, or era has when it is output.

Day Formats

Format type Description

d

Day number, without leading zeros for single-digit days.

dd

Day number, with leading zeros for single-digit days.

ddd

Day of the week, abbreviated as you specify in a LOCALE_SSHORTESTDAYNAME* value, for example, "Mon" in English (United States).

dddd

Day of the week, written as you specify in a LOCALE_SDAYNAME* value.

Month Formats

Format type Description

M

Month number, without leading zeros for single-digit months.

MM

Month number, with leading zeros for single-digit months.

MMM

Month name, abbreviated as you specify in a LOCALE_SABBREVMONTHNAME* value, for example, "Nov" in English (United States).

MMMM

Month name, written as you specify in a LOCALE_SMONTHNAME* value, for example, "November" for English (United States) or "Noviembre" for Spanish (Spain).

Year Formats

Format type Description

y

Year, represented by only the last digit.

yy

Year, represented by only the last two digits. A leading zero is added for single-digit years.

yyyy

Year, represented all applicable digits, depending on the calendar used. Calendars that have single-digit or two-digit years, such as the Japanese era calendar, are represented differently. A single-digit year is represented with a leading zero, for example, "03." A two-digit year is represented with two digits, for example, "13." No additional leading zeros are displayed.

yyyyy

Behaves identically to "yyyy."

Era Formats

Format type Description

g

For Windows 7: Era string, abbreviated as you specify in the CAL_SERASTRING value. The "g" format picture in a date string is ignored if you do not specify an era string in CAL_SERASTRING.

gg

Era string, as you specify in the CAL_SERASTRING value. The "gg" format picture in a date string is ignored you do not specify an era string in CAL_SERASTRING.

Remarks

If you use spaces to separate the elements in the string, these spaces appear in the same location in the output string.

The application uses single quotation marks to mark characters to display exactly as specified. For example, to get the date string "Wed, Aug 31, 09", the application uses the picture string ddd',' MMM dd',' yy.

If the application must display a single quotation mark, it should place two single quotation marks in a row. For example, 'abc''bar', is displayed as "abc'bar".

Note

The format types "d," "g," and "y" must be lowercase, and the letter "M" must be uppercase.

Requirements

Header

winnls.h

Library

Coreloc.lib

See Also

Reference

National/Regional Language Support (NLS) Constants