EnumTimeFormatsEx function (winnls.h)

Enumerates the time formats that are available for a locale specified by name.

Note  The application should call this function in preference to EnumTimeFormats if designed to run only on Windows Vista and later.
 
Note  This function can enumerate data that changes between releases, for example, due to a custom locale. If your application must persist or transmit data, see Using Persistent Locale Data.
 

Syntax

BOOL EnumTimeFormatsEx(
  [in]           TIMEFMT_ENUMPROCEX lpTimeFmtEnumProcEx,
  [in, optional] LPCWSTR            lpLocaleName,
  [in]           DWORD              dwFlags,
  [in]           LPARAM             lParam
);

Parameters

[in] lpTimeFmtEnumProcEx

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

[in, optional] lpLocaleName

Pointer to a locale name, or one of the following predefined values.

[in] dwFlags

The time format. Set to 0 to use the current user's long time format, or TIME_NOSECONDS (starting with Windows 7) to use the short time format.

[in] lParam

An application-provided parameter to be passed to the callback function. This is especially useful for multi-threaded applications.

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

This function enumerates the time formats by passing time format string pointers, one at a time, to the specified application-defined callback function, along with an application-defined constant that is useful for multi-threaded applications. The first value in the enumeration is always the user default (override) value. The function continues enumeration until the last time format is found or the callback function returns FALSE.

Beginning in Windows 8: If your app passes language tags to this function from the Windows.Globalization namespace, it must first convert the tags by calling ResolveLocaleName.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header winnls.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

EnumTimeFormats

EnumTimeFormatsProcEx

National Language Support

National Language Support Functions