Export (0) Print
Expand All
Expand Minimize

EnumTimeFormats function

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

Note  For interoperability reasons, the application should prefer the EnumTimeFormatsEx function to EnumTimeFormats because Microsoft is migrating toward the use of locale names instead of locale identifiers for new locales. Any application that runs only on Windows Vista and later should use EnumTimeFormatsEx.

Syntax


BOOL EnumTimeFormats(
  _In_  TIMEFMT_ENUMPROC lpTimeFmtEnumProc,
  _In_  LCID Locale,
  _In_  DWORD dwFlags
);

Parameters

lpTimeFmtEnumProc [in]

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

Locale [in]

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

dwFlags [in]

The time format. This parameter can specify a combination of any of the following values.

FlagMeaning
0

Use the current user's long time format.

TIME_NOSECONDS

Windows 7 and later: Use the current user's short time format.

Note  This value will not work with the ANSI version of this function, EnumTimeFormatsA.

LOCAL_USE_CP_ACP

Specified with the ANSI version of this function, EnumTimeFormatsA (not recommended), to use the system default Windows ANSI code page (ACP) instead of the locale code page.

 

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

The function enumerates the time formats by passing a pointer to a buffer containing a time format to an application-defined callback function. 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.

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 call can succeed because the system uses the system code page. However, characters that are undefined in the system code page appear in the string as a question mark ("?"). Note that any new values for dwFlags introduced in the future will not work with the ANSI version.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winnls.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

Unicode and ANSI names

EnumTimeFormatsW (Unicode) and EnumTimeFormatsA (ANSI)

See also

National Language Support
National Language Support Functions
EnumTimeFormatsEx
EnumTimeFormatsProc

 

 

Community Additions

ADD
Show:
© 2014 Microsoft