Most locales use the Gregorian calendar, but some editions of Windows also support Hijri (Middle Eastern), Japanese, Korean, and Thai calendars. (Windows will add support for more calendars in the future as necessary.) Windows assigns each locale a default calendar type, which you can retrieve by calling GetLocaleInfo with the LCTYPE set to LOCALE_ICALENDARTYPE. To determine which additional calendar types are valid, set the LCTYPE to LOCALE_IOPTIONALCALENDAR. You can retrieve more detailed information about a specific calendar type or about all the calendar types that a particular locale uses by calling EnumCalendarInfo with one of the constants listed in Figure 5-4.
Constant | Description | ||||||||||||||||||||||||
CAL_ICALINTVALUE | Integer value indicating alternate calendar type. | ||||||||||||||||||||||||
|
|||||||||||||||||||||||||
CAL_IYEAROFFSETRANGE | Null-separated strings containing the Gregorian based year offsets for each of the eras. | ||||||||||||||||||||||||
CAL_SABBREVDAYNAME1 7 | Abbreviated forms of the native-language names of the days. If these values are null, the day names for this calendar are the same as those contained within the corresponding LCTYPE. | ||||||||||||||||||||||||
CAL_SABBREVMONTHNAME1 13 | Abbreviated forms of the native-language names of the months. If these values are null, the month names for this calendar are the same as those contained within the corresponding LCTYPE. | ||||||||||||||||||||||||
CAL_SCALNAME | Native-language name of the alternate calendar. | ||||||||||||||||||||||||
CAL_SDAYNAME1 7 | Native-language names of the days of the week. If these values are null, the day names for this calendar are the same as those contained within the corresponding LCTYPE. | ||||||||||||||||||||||||
CAL_SERASTRING | Null-separated strings containing each of the Unicode code points specifying the era associated with the particular CAL_IYEAROFFSETRANGE. | ||||||||||||||||||||||||
CAL_SLONGDATE | Long-date formats applicable to a particular locale. | ||||||||||||||||||||||||
CAL_SMONTHNAME1 13 | Native-language names of the months. If these values are null, the month names for this calendar are the same as those contained within the corresponding LCTYPE. | ||||||||||||||||||||||||
CAL_SSHORTDATE | Short-date formats applicable to a particular locale. | ||||||||||||||||||||||||
LOCALE_USE_CP_ACP | This may be OR'd with any of the above CALTYPEs to ensure that when the data is converted from Unicode to ANSI, in order to return values to theA APIs, the system ANSI code-page value is used for translation rather than the default ANSI code- page value associated with the LCID passed in. |
Figure 5-4 Constants used in conjunction with EnumCalendarInfo.
EnumDateFormat also returns information about alternate calendars, but the information returned by EnumCalendarInfo is easier to parse.
Aside from LOCALE_ICALENDARTYPE and LOCALE_IOPTIONALCALENDAR, two other LCTYPEs deal with calendars: LOCALE_IFIRSTDAYOFWEEK and LOCALE_IFIRSTWEEKOFYEAR. Although calendars in the United States list Sunday as the first day of the week, calendars in other countries, such as Germany, list Monday as the first day of the week. Similarly, not all cultures assume that the week containing January 1 is the first week of the year.