EnumDateFormatsExA function

Enumerates the long date, short date, or year/month formats that are available for a specified locale.

Note  Any application that runs only on Windows Vista and later should use EnumDateFormatsExEx in preference to this function.
 

Syntax

BOOL EnumDateFormatsExA(
  DATEFMT_ENUMPROCEXA lpDateFmtEnumProcEx,
  LCID                Locale,
  DWORD               dwFlags
);

Parameters

lpDateFmtEnumProcEx

Pointer to an application-defined callback function. For more information, see EnumDateFormatsProcEx.

Locale

Locale identifier that specifies the locale for which to retrieve date format information. You can use the MAKELCID macro to create an identifier or use one of the following predefined values.

Windows Vista and later: The following custom locale identifiers are also supported.

dwFlags

Flag specifying date formats. For detailed definitions, see the dwFlags parameter of EnumDateFormatsExEx.

Return Value

Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call GetLastError, which can return one of the following error codes:

  • ERROR_INVALID_FLAGS. The values supplied for flags were not valid.
  • ERROR_INVALID_PARAMETER. Any of the parameter values was invalid.

Remarks

Note  This API is being updated to support the May 2019 Japanese era change. If your application supports the Japanese calendar, you should validate that it properly handles the new era. See Prepare your application for the Japanese era change for more information.
 
The function enumerates the date formats by passing date format string pointers, one at a time, to the specified application-defined callback function. This process continues until EnumDateFormatsEx finds the last date format or the callback function returns FALSE.

This function enumerates all date formats for the specified locale, including alternate calendars, if any. However, the calendar identifier is not enumerated along with the date format, making formats for locales with alternate calendars difficult to use.

This function can enumerate data from custom locales. Data is not guaranteed to be the same from computer to computer or between runs of an application. If your application must persist or transmit data, see Using Persistent Locale Data.

When the ANSI version of this function is used with a Unicode-only locale identifier, the function can succeed because the operating system uses the system code page. However, characters that are undefined in the system code page appear in the string as a question mark (?).

The application should use EnumDateFormatsEx (instead of EnumDateFormats) to enumerate date formats for locales with alternate calendars.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winnls.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See Also

EnumDateFormats

EnumDateFormatsExEx

EnumDateFormatsProcEx

National Language Support

National Language Support Functions