Partager via


EnumDateFormats

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function enumerates the long or short date formats that are available for a specified locale, including date formats for any alternate calendars.

Note

If you specify a locale with the LCID (Locale ID) parameter and that locale is not installed or available on the Windows® phone, the function fails with ERROR_INVALID_PARAMETER. To determine whether the locale is supported or not, call IsValidLocale.

Syntax

BOOL EnumDateFormats(
  DATEFMT_ENUMPROC lpDateFmtEnumProc, 
  LCID Locale, 
  DWORD dwFlags
); 

Parameters

  • lpDateFmtEnumProc
    [in] Pointer to an application-defined callback function. The EnumDateFormats function enumerates date formats by making repeated calls to this callback function. For more information, see the EnumDateFormatsProc callback function.
  • Locale
    [in] Value that specifies the locale to retrieve date format information for. This parameter can be a locale identifier created by the MAKELCID macro, or one of the following predefined values. The following table shows the values this parameter can take.

    Value Description

    LOCALE_SYSTEM_DEFAULT

    Default system locale.

    LOCALE_USER_DEFAULT

    Default user locale.

    LOCALE_NEUTRAL

    Default language-neutral locale.

  • dwFlags
    [in] Value that specifies the date formats that are of interest. The following table shows the values this parameter can take.

    Value Description

    DATE_SHORTDATE

    Return short date formats.

    DATE_LONGDATE

    Return long date formats.

Return Value

Nonzero indicates success. Zero indicates failure. To get extended error information, call the GetLastError function. The following table shows possible return values for the GetLastError function**.**

Value Description

ERROR_INVALID_PARAMETER

The parameter is incorrect, or the specified LCID is not supported on the device.

Remarks

For more information about LCID, see National Language support (NLS) Locale Identifiers.

The DATE_SHORTDATE and DATE_LONGDATE flags are mutually exclusive. Use one or the other, but not both.

For Windows CE 2.10 and later, default DATE_SHORTDATE formats for non-U.S. English locales that include the four-digit year are added. The following table shows the formats.

Locale Date Format

United Kingdom

dd/MM/yyyy

Canada

dd/MM/yyyy

New Zealand

dd/MM/yyyy

Ireland

dd/MM/yyyy

South Africa

dd/MM/yyyy

Caribbean

MM/dd/yyyy

Belize

dd/MM/yyyy

Trinidad

dd/MM/yyyy

Requirements

Header winnls.h
Library Coreloc.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

EnumCalendarInfo
EnumDateFormatsProc
EnumTimeFormats
MAKELCID

Other Resources

National Language Support (NLS) Locale Identifiers