Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

SetCalendarInfo function

Sets an item of locale information for a calendar. For more information, see Date and Calendar.

Syntax


BOOL SetCalendarInfo(
  _In_  LCID Locale,
  _In_  CALID Calendar,
  _In_  CALTYPE CalType,
  _In_  LPCTSTR lpCalData
);

Parameters

Locale [in]

Locale identifier that specifies the locale. You can use the MAKELCID macro to create a locale identifier or use one of the following predefined values.

The following custom locale identifiers are also supported.

Calendar [in]

Calendar identifier for the calendar for which to set information.

CalType [in]

Type of calendar information to set. Only the following CALTYPE values are valid for this function. The CAL_USE_CP_ACP constant is only meaningful for the ANSI version of the function.

  • CAL_USE_CP_ACP
  • CAL_ITWODIGITYEARMAX

The application can specify only one calendar identifier per call to this function. An exception can be made if the application uses the binary OR operator to combine CAL_USE_CP_ACP with any valid CALTYPE value defined in Calendar Type Information.

lpCalData [in]

Pointer to a null-terminated calendar information string. The information must be in the format of the specified calendar type.

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_INTERNAL_ERROR. An unexpected error occurred in the function.
  • ERROR_INVALID_FLAGS. The values supplied for flags were not valid.
  • ERROR_INVALID_PARAMETER. Any of the parameter values was invalid.

Remarks

This function only affects the user override portion of the calendar settings. It does not set the system defaults.

Calendar information is always passed as a null-terminated Unicode string in the Unicode version of this function, and as a null-terminated ANSI string in the ANSI version. No integers are allowed by this function. Any numeric values must be specified as either Unicode or ANSI text.

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 (?).

CAL_ITWODIGITYEARMAX can be used with any calendar, even if the calendar is not supported for the specified locale. To avoid complications, the application should call EnumCalendarInfo to ensure that the calendar is supported for the locale of interest.

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

SetCalendarInfoW (Unicode) and SetCalendarInfoA (ANSI)

See also

National Language Support
National Language Support Functions
EnumCalendarInfo
GetCalendarInfo

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.