Home | History | Annotate | Download | only in unicode
      1 /*
      2  *******************************************************************************
      3  * Copyright (C) 1996-2009, International Business Machines Corporation and
      4  * others. All Rights Reserved.
      5  *******************************************************************************
      6  */
      7 
      8 #ifndef UCAL_H
      9 #define UCAL_H
     10 
     11 #include "unicode/utypes.h"
     12 #include "unicode/uenum.h"
     13 #include "unicode/uloc.h"
     14 
     15 #if !UCONFIG_NO_FORMATTING
     16 
     17 /**
     18  * \file
     19  * \brief C API: Calendar
     20  *
     21  * <h2>Calendar C API</h2>
     22  *
     23  * UCalendar C API is used  for converting between a <code>UDate</code> object
     24  * and a set of integer fields such as <code>UCAL_YEAR</code>, <code>UCAL_MONTH</code>,
     25  * <code>UCAL_DAY</code>, <code>UCAL_HOUR</code>, and so on.
     26  * (A <code>UDate</code> object represents a specific instant in
     27  * time with millisecond precision. See UDate
     28  * for information about the <code>UDate</code> .)
     29  *
     30  * <p>
     31  * Types of <code>UCalendar</code> interpret a <code>UDate</code>
     32  * according to the rules of a specific calendar system. The U_STABLE
     33  * provides the enum UCalendarType with UCAL_TRADITIONAL and
     34  * UCAL_GREGORIAN.
     35  * <p>
     36  * Like other locale-sensitive C API, calendar API  provides a
     37  * function, <code>ucal_open()</code>, which returns a pointer to
     38  * <code>UCalendar</code> whose time fields have been initialized
     39  * with the current date and time. We need to specify the type of
     40  * calendar to be opened and the  timezoneId.
     41  * \htmlonly<blockquote>\endhtmlonly
     42  * <pre>
     43  * \code
     44  * UCalendar *caldef;
     45  * UChar *tzId;
     46  * UErrorCode status;
     47  * tzId=(UChar*)malloc(sizeof(UChar) * (strlen("PST") +1) );
     48  * u_uastrcpy(tzId, "PST");
     49  * caldef=ucal_open(tzID, u_strlen(tzID), NULL, UCAL_TRADITIONAL, &status);
     50  * \endcode
     51  * </pre>
     52  * \htmlonly</blockquote>\endhtmlonly
     53  *
     54  * <p>
     55  * A <code>UCalendar</code> object can produce all the time field values
     56  * needed to implement the date-time formatting for a particular language
     57  * and calendar style (for example, Japanese-Gregorian, Japanese-Traditional).
     58  *
     59  * <p>
     60  * When computing a <code>UDate</code> from time fields, two special circumstances
     61  * may arise: there may be insufficient information to compute the
     62  * <code>UDate</code> (such as only year and month but no day in the month),
     63  * or there may be inconsistent information (such as "Tuesday, July 15, 1996"
     64  * -- July 15, 1996 is actually a Monday).
     65  *
     66  * <p>
     67  * <strong>Insufficient information.</strong> The calendar will use default
     68  * information to specify the missing fields. This may vary by calendar; for
     69  * the Gregorian calendar, the default for a field is the same as that of the
     70  * start of the epoch: i.e., UCAL_YEAR = 1970, UCAL_MONTH = JANUARY, UCAL_DATE = 1, etc.
     71  *
     72  * <p>
     73  * <strong>Inconsistent information.</strong> If fields conflict, the calendar
     74  * will give preference to fields set more recently. For example, when
     75  * determining the day, the calendar will look for one of the following
     76  * combinations of fields.  The most recent combination, as determined by the
     77  * most recently set single field, will be used.
     78  *
     79  * \htmlonly<blockquote>\endhtmlonly
     80  * <pre>
     81  * \code
     82  * UCAL_MONTH + UCAL_DAY_OF_MONTH
     83  * UCAL_MONTH + UCAL_WEEK_OF_MONTH + UCAL_DAY_OF_WEEK
     84  * UCAL_MONTH + UCAL_DAY_OF_WEEK_IN_MONTH + UCAL_DAY_OF_WEEK
     85  * UCAL_DAY_OF_YEAR
     86  * UCAL_DAY_OF_WEEK + UCAL_WEEK_OF_YEAR
     87  * \endcode
     88  * </pre>
     89  * \htmlonly</blockquote>\endhtmlonly
     90  *
     91  * For the time of day:
     92  *
     93  * \htmlonly<blockquote>\endhtmlonly
     94  * <pre>
     95  * \code
     96  * UCAL_HOUR_OF_DAY
     97  * UCAL_AM_PM + UCAL_HOUR
     98  * \endcode
     99  * </pre>
    100  * \htmlonly</blockquote>\endhtmlonly
    101  *
    102  * <p>
    103  * <strong>Note:</strong> for some non-Gregorian calendars, different
    104  * fields may be necessary for complete disambiguation. For example, a full
    105  * specification of the historial Arabic astronomical calendar requires year,
    106  * month, day-of-month <em>and</em> day-of-week in some cases.
    107  *
    108  * <p>
    109  * <strong>Note:</strong> There are certain possible ambiguities in
    110  * interpretation of certain singular times, which are resolved in the
    111  * following ways:
    112  * <ol>
    113  *     <li> 24:00:00 "belongs" to the following day. That is,
    114  *          23:59 on Dec 31, 1969 &lt; 24:00 on Jan 1, 1970 &lt; 24:01:00 on Jan 1, 1970
    115  *
    116  *     <li> Although historically not precise, midnight also belongs to "am",
    117  *          and noon belongs to "pm", so on the same day,
    118  *          12:00 am (midnight) &lt; 12:01 am, and 12:00 pm (noon) &lt; 12:01 pm
    119  * </ol>
    120  *
    121  * <p>
    122  * The date or time format strings are not part of the definition of a
    123  * calendar, as those must be modifiable or overridable by the user at
    124  * runtime. Use {@link DateFormat}
    125  * to format dates.
    126  *
    127  * <p>
    128  * <code>Calendar</code> provides an API for field "rolling", where fields
    129  * can be incremented or decremented, but wrap around. For example, rolling the
    130  * month up in the date <code>December 12, <b>1996</b></code> results in
    131  * <code>January 12, <b>1996</b></code>.
    132  *
    133  * <p>
    134  * <code>Calendar</code> also provides a date arithmetic function for
    135  * adding the specified (signed) amount of time to a particular time field.
    136  * For example, subtracting 5 days from the date <code>September 12, 1996</code>
    137  * results in <code>September 7, 1996</code>.
    138  *
    139  * @stable ICU 2.0
    140  */
    141 
    142 /** A calendar.
    143  *  For usage in C programs.
    144  * @stable ICU 2.0
    145  */
    146 typedef void* UCalendar;
    147 
    148 /** Possible types of UCalendars
    149  * @stable ICU 2.0
    150  */
    151 enum UCalendarType {
    152   /**
    153    * Despite the name, UCAL_TRADITIONAL designates the locale's default calendar,
    154    * which may be the Gregorian calendar or some other calendar.
    155    * @stable ICU 2.0
    156    */
    157   UCAL_TRADITIONAL,
    158   /**
    159    * Unambiguously designates the Gregorian calendar for the locale.
    160    * @stable ICU 2.0
    161    */
    162   UCAL_GREGORIAN,
    163   /**
    164    * A better name for UCAL_TRADITIONAL.
    165    * @draft ICU 4.2
    166    */
    167   UCAL_DEFAULT = UCAL_TRADITIONAL
    168 };
    169 
    170 /** @stable ICU 2.0 */
    171 typedef enum UCalendarType UCalendarType;
    172 
    173 /** Possible fields in a UCalendar
    174  * @stable ICU 2.0
    175  */
    176 enum UCalendarDateFields {
    177   /**
    178    * Field number indicating the era, e.g., AD or BC in the Gregorian (Julian) calendar.
    179    * This is a calendar-specific value.
    180    * @stable ICU 2.6
    181    */
    182   UCAL_ERA,
    183 
    184   /**
    185    * Field number indicating the year. This is a calendar-specific value.
    186    * @stable ICU 2.6
    187    */
    188   UCAL_YEAR,
    189 
    190   /**
    191    * Field number indicating the month. This is a calendar-specific value.
    192    * The first month of the year is
    193    * <code>JANUARY</code>; the last depends on the number of months in a year.
    194    * @see #UCAL_JANUARY
    195    * @see #UCAL_FEBRUARY
    196    * @see #UCAL_MARCH
    197    * @see #UCAL_APRIL
    198    * @see #UCAL_MAY
    199    * @see #UCAL_JUNE
    200    * @see #UCAL_JULY
    201    * @see #UCAL_AUGUST
    202    * @see #UCAL_SEPTEMBER
    203    * @see #UCAL_OCTOBER
    204    * @see #UCAL_NOVEMBER
    205    * @see #UCAL_DECEMBER
    206    * @see #UCAL_UNDECIMBER
    207    * @stable ICU 2.6
    208    */
    209   UCAL_MONTH,
    210 
    211   /**
    212    * Field number indicating the
    213    * week number within the current year.  The first week of the year, as
    214    * defined by <code>UCAL_FIRST_DAY_OF_WEEK</code> and <code>UCAL_MINIMAL_DAYS_IN_FIRST_WEEK</code>
    215    * attributes, has value 1.  Subclasses define
    216    * the value of <code>UCAL_WEEK_OF_YEAR</code> for days before the first week of
    217    * the year.
    218    * @see ucal_getAttribute
    219    * @see ucal_setAttribute
    220    * @stable ICU 2.6
    221    */
    222   UCAL_WEEK_OF_YEAR,
    223 
    224  /**
    225    * Field number indicating the
    226    * week number within the current month.  The first week of the month, as
    227    * defined by <code>UCAL_FIRST_DAY_OF_WEEK</code> and <code>UCAL_MINIMAL_DAYS_IN_FIRST_WEEK</code>
    228    * attributes, has value 1.  Subclasses define
    229    * the value of <code>WEEK_OF_MONTH</code> for days before the first week of
    230    * the month.
    231    * @see ucal_getAttribute
    232    * @see ucal_setAttribute
    233    * @see #UCAL_FIRST_DAY_OF_WEEK
    234    * @see #UCAL_MINIMAL_DAYS_IN_FIRST_WEEK
    235    * @stable ICU 2.6
    236    */
    237   UCAL_WEEK_OF_MONTH,
    238 
    239  /**
    240    * Field number indicating the
    241    * day of the month. This is a synonym for <code>DAY_OF_MONTH</code>.
    242    * The first day of the month has value 1.
    243    * @see #UCAL_DAY_OF_MONTH
    244    * @stable ICU 2.6
    245    */
    246   UCAL_DATE,
    247 
    248  /**
    249    * Field number indicating the day
    250    * number within the current year.  The first day of the year has value 1.
    251    * @stable ICU 2.6
    252    */
    253   UCAL_DAY_OF_YEAR,
    254 
    255  /**
    256    * Field number indicating the day
    257    * of the week.  This field takes values <code>SUNDAY</code>,
    258    * <code>MONDAY</code>, <code>TUESDAY</code>, <code>WEDNESDAY</code>,
    259    * <code>THURSDAY</code>, <code>FRIDAY</code>, and <code>SATURDAY</code>.
    260    * @see #UCAL_SUNDAY
    261    * @see #UCAL_MONDAY
    262    * @see #UCAL_TUESDAY
    263    * @see #UCAL_WEDNESDAY
    264    * @see #UCAL_THURSDAY
    265    * @see #UCAL_FRIDAY
    266    * @see #UCAL_SATURDAY
    267    * @stable ICU 2.6
    268    */
    269   UCAL_DAY_OF_WEEK,
    270 
    271  /**
    272    * Field number indicating the
    273    * ordinal number of the day of the week within the current month. Together
    274    * with the <code>DAY_OF_WEEK</code> field, this uniquely specifies a day
    275    * within a month.  Unlike <code>WEEK_OF_MONTH</code> and
    276    * <code>WEEK_OF_YEAR</code>, this field's value does <em>not</em> depend on
    277    * <code>getFirstDayOfWeek()</code> or
    278    * <code>getMinimalDaysInFirstWeek()</code>.  <code>DAY_OF_MONTH 1</code>
    279    * through <code>7</code> always correspond to <code>DAY_OF_WEEK_IN_MONTH
    280    * 1</code>; <code>8</code> through <code>15</code> correspond to
    281    * <code>DAY_OF_WEEK_IN_MONTH 2</code>, and so on.
    282    * <code>DAY_OF_WEEK_IN_MONTH 0</code> indicates the week before
    283    * <code>DAY_OF_WEEK_IN_MONTH 1</code>.  Negative values count back from the
    284    * end of the month, so the last Sunday of a month is specified as
    285    * <code>DAY_OF_WEEK = SUNDAY, DAY_OF_WEEK_IN_MONTH = -1</code>.  Because
    286    * negative values count backward they will usually be aligned differently
    287    * within the month than positive values.  For example, if a month has 31
    288    * days, <code>DAY_OF_WEEK_IN_MONTH -1</code> will overlap
    289    * <code>DAY_OF_WEEK_IN_MONTH 5</code> and the end of <code>4</code>.
    290    * @see #UCAL_DAY_OF_WEEK
    291    * @see #UCAL_WEEK_OF_MONTH
    292    * @stable ICU 2.6
    293    */
    294   UCAL_DAY_OF_WEEK_IN_MONTH,
    295 
    296  /**
    297    * Field number indicating
    298    * whether the <code>HOUR</code> is before or after noon.
    299    * E.g., at 10:04:15.250 PM the <code>AM_PM</code> is <code>PM</code>.
    300    * @see #UCAL_AM
    301    * @see #UCAL_PM
    302    * @see #UCAL_HOUR
    303    * @stable ICU 2.6
    304    */
    305   UCAL_AM_PM,
    306 
    307  /**
    308    * Field number indicating the
    309    * hour of the morning or afternoon. <code>HOUR</code> is used for the 12-hour
    310    * clock.
    311    * E.g., at 10:04:15.250 PM the <code>HOUR</code> is 10.
    312    * @see #UCAL_AM_PM
    313    * @see #UCAL_HOUR_OF_DAY
    314    * @stable ICU 2.6
    315    */
    316   UCAL_HOUR,
    317 
    318  /**
    319    * Field number indicating the
    320    * hour of the day. <code>HOUR_OF_DAY</code> is used for the 24-hour clock.
    321    * E.g., at 10:04:15.250 PM the <code>HOUR_OF_DAY</code> is 22.
    322    * @see #UCAL_HOUR
    323    * @stable ICU 2.6
    324    */
    325   UCAL_HOUR_OF_DAY,
    326 
    327  /**
    328    * Field number indicating the
    329    * minute within the hour.
    330    * E.g., at 10:04:15.250 PM the <code>UCAL_MINUTE</code> is 4.
    331    * @stable ICU 2.6
    332    */
    333   UCAL_MINUTE,
    334 
    335  /**
    336    * Field number indicating the
    337    * second within the minute.
    338    * E.g., at 10:04:15.250 PM the <code>UCAL_SECOND</code> is 15.
    339    * @stable ICU 2.6
    340    */
    341   UCAL_SECOND,
    342 
    343  /**
    344    * Field number indicating the
    345    * millisecond within the second.
    346    * E.g., at 10:04:15.250 PM the <code>UCAL_MILLISECOND</code> is 250.
    347    * @stable ICU 2.6
    348    */
    349   UCAL_MILLISECOND,
    350 
    351  /**
    352    * Field number indicating the
    353    * raw offset from GMT in milliseconds.
    354    * @stable ICU 2.6
    355    */
    356   UCAL_ZONE_OFFSET,
    357 
    358  /**
    359    * Field number indicating the
    360    * daylight savings offset in milliseconds.
    361    * @stable ICU 2.6
    362    */
    363   UCAL_DST_OFFSET,
    364 
    365  /**
    366    * Field number
    367    * indicating the extended year corresponding to the
    368    * <code>UCAL_WEEK_OF_YEAR</code> field.  This may be one greater or less
    369    * than the value of <code>UCAL_EXTENDED_YEAR</code>.
    370    * @stable ICU 2.6
    371    */
    372   UCAL_YEAR_WOY,
    373 
    374  /**
    375    * Field number
    376    * indicating the localized day of week.  This will be a value from 1
    377    * to 7 inclusive, with 1 being the localized first day of the week.
    378    * @stable ICU 2.6
    379    */
    380   UCAL_DOW_LOCAL,
    381 
    382   /**
    383    * Year of this calendar system, encompassing all supra-year fields. For example,
    384    * in Gregorian/Julian calendars, positive Extended Year values indicate years AD,
    385    *  1 BC = 0 extended, 2 BC = -1 extended, and so on.
    386    * @stable ICU 2.8
    387    */
    388   UCAL_EXTENDED_YEAR,
    389 
    390  /**
    391    * Field number
    392    * indicating the modified Julian day number.  This is different from
    393    * the conventional Julian day number in two regards.  First, it
    394    * demarcates days at local zone midnight, rather than noon GMT.
    395    * Second, it is a local number; that is, it depends on the local time
    396    * zone.  It can be thought of as a single number that encompasses all
    397    * the date-related fields.
    398    * @stable ICU 2.8
    399    */
    400   UCAL_JULIAN_DAY,
    401 
    402   /**
    403    * Ranges from 0 to 23:59:59.999 (regardless of DST).  This field behaves <em>exactly</em>
    404    * like a composite of all time-related fields, not including the zone fields.  As such,
    405    * it also reflects discontinuities of those fields on DST transition days.  On a day
    406    * of DST onset, it will jump forward.  On a day of DST cessation, it will jump
    407    * backward.  This reflects the fact that it must be combined with the DST_OFFSET field
    408    * to obtain a unique local time value.
    409    * @stable ICU 2.8
    410    */
    411   UCAL_MILLISECONDS_IN_DAY,
    412 
    413   /**
    414    * Whether or not the current month is a leap month (0 or 1). See the Chinese calendar for
    415    * an example of this.
    416    */
    417   UCAL_IS_LEAP_MONTH,
    418 
    419   /**
    420    * Field count
    421    * @stable ICU 2.6
    422    */
    423   UCAL_FIELD_COUNT,
    424 
    425  /**
    426    * Field number indicating the
    427    * day of the month. This is a synonym for <code>UCAL_DATE</code>.
    428    * The first day of the month has value 1.
    429    * @see #UCAL_DATE
    430    * Synonym for UCAL_DATE
    431    * @stable ICU 2.8
    432    **/
    433   UCAL_DAY_OF_MONTH=UCAL_DATE
    434 };
    435 
    436 /** @stable ICU 2.0 */
    437 typedef enum UCalendarDateFields UCalendarDateFields;
    438     /**
    439      * Useful constant for days of week. Note: Calendar day-of-week is 1-based. Clients
    440      * who create locale resources for the field of first-day-of-week should be aware of
    441      * this. For instance, in US locale, first-day-of-week is set to 1, i.e., UCAL_SUNDAY.
    442      */
    443 /** Possible days of the week in a UCalendar
    444  * @stable ICU 2.0
    445  */
    446 enum UCalendarDaysOfWeek {
    447   /** Sunday */
    448   UCAL_SUNDAY = 1,
    449   /** Monday */
    450   UCAL_MONDAY,
    451   /** Tuesday */
    452   UCAL_TUESDAY,
    453   /** Wednesday */
    454   UCAL_WEDNESDAY,
    455   /** Thursday */
    456   UCAL_THURSDAY,
    457   /** Friday */
    458   UCAL_FRIDAY,
    459   /** Saturday */
    460   UCAL_SATURDAY
    461 };
    462 
    463 /** @stable ICU 2.0 */
    464 typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek;
    465 
    466 /** Possible months in a UCalendar. Note: Calendar month is 0-based.
    467  * @stable ICU 2.0
    468  */
    469 enum UCalendarMonths {
    470   /** January */
    471   UCAL_JANUARY,
    472   /** February */
    473   UCAL_FEBRUARY,
    474   /** March */
    475   UCAL_MARCH,
    476   /** April */
    477   UCAL_APRIL,
    478   /** May */
    479   UCAL_MAY,
    480   /** June */
    481   UCAL_JUNE,
    482   /** July */
    483   UCAL_JULY,
    484   /** August */
    485   UCAL_AUGUST,
    486   /** September */
    487   UCAL_SEPTEMBER,
    488   /** October */
    489   UCAL_OCTOBER,
    490   /** November */
    491   UCAL_NOVEMBER,
    492   /** December */
    493   UCAL_DECEMBER,
    494   /** Value of the <code>UCAL_MONTH</code> field indicating the
    495     * thirteenth month of the year. Although the Gregorian calendar
    496     * does not use this value, lunar calendars do.
    497     */
    498   UCAL_UNDECIMBER
    499 };
    500 
    501 /** @stable ICU 2.0 */
    502 typedef enum UCalendarMonths UCalendarMonths;
    503 
    504 /** Possible AM/PM values in a UCalendar
    505  * @stable ICU 2.0
    506  */
    507 enum UCalendarAMPMs {
    508     /** AM */
    509   UCAL_AM,
    510   /** PM */
    511   UCAL_PM
    512 };
    513 
    514 /** @stable ICU 2.0 */
    515 typedef enum UCalendarAMPMs UCalendarAMPMs;
    516 
    517 /**
    518  * Create an enumeration over all time zones.
    519  *
    520  * @param ec input/output error code
    521  *
    522  * @return an enumeration object that the caller must dispose of using
    523  * uenum_close(), or NULL upon failure. In case of failure *ec will
    524  * indicate the error.
    525  *
    526  * @stable ICU 2.6
    527  */
    528 U_STABLE UEnumeration* U_EXPORT2
    529 ucal_openTimeZones(UErrorCode* ec);
    530 
    531 /**
    532  * Create an enumeration over all time zones associated with the given
    533  * country. Some zones are affiliated with no country (e.g., "UTC");
    534  * these may also be retrieved, as a group.
    535  *
    536  * @param country the ISO 3166 two-letter country code, or NULL to
    537  * retrieve zones not affiliated with any country
    538  *
    539  * @param ec input/output error code
    540  *
    541  * @return an enumeration object that the caller must dispose of using
    542  * uenum_close(), or NULL upon failure. In case of failure *ec will
    543  * indicate the error.
    544  *
    545  * @stable ICU 2.6
    546  */
    547 U_STABLE UEnumeration* U_EXPORT2
    548 ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
    549 
    550 /**
    551  * Return the default time zone. The default is determined initially
    552  * by querying the host operating system. It may be changed with
    553  * ucal_setDefaultTimeZone() or with the C++ TimeZone API.
    554  *
    555  * @param result A buffer to receive the result, or NULL
    556  *
    557  * @param resultCapacity The capacity of the result buffer
    558  *
    559  * @param ec input/output error code
    560  *
    561  * @return The result string length, not including the terminating
    562  * null
    563  *
    564  * @stable ICU 2.6
    565  */
    566 U_STABLE int32_t U_EXPORT2
    567 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
    568 
    569 /**
    570  * Set the default time zone.
    571  *
    572  * @param zoneID null-terminated time zone ID
    573  *
    574  * @param ec input/output error code
    575  *
    576  * @stable ICU 2.6
    577  */
    578 U_STABLE void U_EXPORT2
    579 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
    580 
    581 /**
    582  * Return the amount of time in milliseconds that the clock is
    583  * advanced during daylight savings time for the given time zone, or
    584  * zero if the time zone does not observe daylight savings time.
    585  *
    586  * @param zoneID null-terminated time zone ID
    587  *
    588  * @param ec input/output error code
    589  *
    590  * @return the number of milliseconds the time is advanced with
    591  * respect to standard time when the daylight savings rules are in
    592  * effect. This is always a non-negative number, most commonly either
    593  * 3,600,000 (one hour) or zero.
    594  *
    595  * @stable ICU 2.6
    596  */
    597 U_STABLE int32_t U_EXPORT2
    598 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec);
    599 
    600 /**
    601  * Get the current date and time.
    602  * The value returned is represented as milliseconds from the epoch.
    603  * @return The current date and time.
    604  * @stable ICU 2.0
    605  */
    606 U_STABLE UDate U_EXPORT2
    607 ucal_getNow(void);
    608 
    609 /**
    610  * Open a UCalendar.
    611  * A UCalendar may be used to convert a millisecond value to a year,
    612  * month, and day.
    613  * <p>
    614  * Note: When unknown TimeZone ID is specified, the UCalendar returned
    615  * by the function is initialized with GMT ("Etc/GMT") without any
    616  * errors/warnings.  If you want to check if a TimeZone ID is valid,
    617  * use ucal_getCanonicalTimeZoneID prior to this function.
    618  *
    619  * @param zoneID The desired TimeZone ID.  If 0, use the default time zone.
    620  * @param len The length of zoneID, or -1 if null-terminated.
    621  * @param locale The desired locale
    622  * @param type The type of UCalendar to open. This can be UCAL_GREGORIAN to open the Gregorian
    623  * calendar for the locale, or UCAL_DEFAULT to open the default calendar for the locale (the
    624  * default calendar may also be Gregorian). To open a specific non-Gregorian calendar for the
    625  * locale, use uloc_setKeywordValue to set the value of the calendar keyword for the locale
    626  * and then pass the locale to ucal_open with UCAL_DEFAULT as the type.
    627  * @param status A pointer to an UErrorCode to receive any errors
    628  * @return A pointer to a UCalendar, or 0 if an error occurred.
    629  * @stable ICU 2.0
    630  */
    631 U_STABLE UCalendar* U_EXPORT2
    632 ucal_open(const UChar*   zoneID,
    633           int32_t        len,
    634           const char*    locale,
    635           UCalendarType  type,
    636           UErrorCode*    status);
    637 
    638 /**
    639  * Close a UCalendar.
    640  * Once closed, a UCalendar may no longer be used.
    641  * @param cal The UCalendar to close.
    642  * @stable ICU 2.0
    643  */
    644 U_STABLE void U_EXPORT2
    645 ucal_close(UCalendar *cal);
    646 
    647 /**
    648  * Open a copy of a UCalendar.
    649  * This function performs a deep copy.
    650  * @param cal The calendar to copy
    651  * @param status A pointer to an UErrorCode to receive any errors.
    652  * @return A pointer to a UCalendar identical to cal.
    653  * @stable ICU 4.0
    654  */
    655 U_DRAFT UCalendar* U_EXPORT2
    656 ucal_clone(const UCalendar* cal,
    657            UErrorCode*      status);
    658 
    659 /**
    660  * Set the TimeZone used by a UCalendar.
    661  * A UCalendar uses a timezone for converting from Greenwich time to local time.
    662  * @param cal The UCalendar to set.
    663  * @param zoneID The desired TimeZone ID.  If 0, use the default time zone.
    664  * @param len The length of zoneID, or -1 if null-terminated.
    665  * @param status A pointer to an UErrorCode to receive any errors.
    666  * @stable ICU 2.0
    667  */
    668 U_STABLE void U_EXPORT2
    669 ucal_setTimeZone(UCalendar*    cal,
    670                  const UChar*  zoneID,
    671                  int32_t       len,
    672                  UErrorCode*   status);
    673 
    674 /**
    675  * Possible formats for a UCalendar's display name
    676  * @stable ICU 2.0
    677  */
    678 enum UCalendarDisplayNameType {
    679   /** Standard display name */
    680   UCAL_STANDARD,
    681   /** Short standard display name */
    682   UCAL_SHORT_STANDARD,
    683   /** Daylight savings display name */
    684   UCAL_DST,
    685   /** Short daylight savings display name */
    686   UCAL_SHORT_DST
    687 };
    688 
    689 /** @stable ICU 2.0 */
    690 typedef enum UCalendarDisplayNameType UCalendarDisplayNameType;
    691 
    692 /**
    693  * Get the display name for a UCalendar's TimeZone.
    694  * A display name is suitable for presentation to a user.
    695  * @param cal          The UCalendar to query.
    696  * @param type         The desired display name format; one of UCAL_STANDARD, UCAL_SHORT_STANDARD,
    697  *                     UCAL_DST, UCAL_SHORT_DST
    698  * @param locale       The desired locale for the display name.
    699  * @param result       A pointer to a buffer to receive the formatted number.
    700  * @param resultLength The maximum size of result.
    701  * @param status       A pointer to an UErrorCode to receive any errors
    702  * @return             The total buffer size needed; if greater than resultLength, the output was truncated.
    703  * @stable ICU 2.0
    704  */
    705 U_STABLE int32_t U_EXPORT2
    706 ucal_getTimeZoneDisplayName(const UCalendar*          cal,
    707                             UCalendarDisplayNameType  type,
    708                             const char*               locale,
    709                             UChar*                    result,
    710                             int32_t                   resultLength,
    711                             UErrorCode*               status);
    712 
    713 /**
    714  * Determine if a UCalendar is currently in daylight savings time.
    715  * Daylight savings time is not used in all parts of the world.
    716  * @param cal The UCalendar to query.
    717  * @param status A pointer to an UErrorCode to receive any errors
    718  * @return TRUE if cal is currently in daylight savings time, FALSE otherwise
    719  * @stable ICU 2.0
    720  */
    721 U_STABLE UBool U_EXPORT2
    722 ucal_inDaylightTime(const UCalendar*  cal,
    723                     UErrorCode*       status );
    724 
    725 /**
    726  * Sets the GregorianCalendar change date. This is the point when the switch from
    727  * Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October
    728  * 15, 1582. Previous to this time and date will be Julian dates.
    729  *
    730  * This function works only for Gregorian calendars. If the UCalendar is not
    731  * an instance of a Gregorian calendar, then a U_UNSUPPORTED_ERROR
    732  * error code is set.
    733  *
    734  * @param cal        The calendar object.
    735  * @param date       The given Gregorian cutover date.
    736  * @param pErrorCode Pointer to a standard ICU error code. Its input value must
    737  *                   pass the U_SUCCESS() test, or else the function returns
    738  *                   immediately. Check for U_FAILURE() on output or use with
    739  *                   function chaining. (See User Guide for details.)
    740  *
    741  * @see GregorianCalendar::setGregorianChange
    742  * @see ucal_getGregorianChange
    743  * @stable ICU 3.6
    744  */
    745 U_STABLE void U_EXPORT2
    746 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode);
    747 
    748 /**
    749  * Gets the Gregorian Calendar change date. This is the point when the switch from
    750  * Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October
    751  * 15, 1582. Previous to this time and date will be Julian dates.
    752  *
    753  * This function works only for Gregorian calendars. If the UCalendar is not
    754  * an instance of a Gregorian calendar, then a U_UNSUPPORTED_ERROR
    755  * error code is set.
    756  *
    757  * @param cal        The calendar object.
    758  * @param pErrorCode Pointer to a standard ICU error code. Its input value must
    759  *                   pass the U_SUCCESS() test, or else the function returns
    760  *                   immediately. Check for U_FAILURE() on output or use with
    761  *                   function chaining. (See User Guide for details.)
    762  * @return   The Gregorian cutover time for this calendar.
    763  *
    764  * @see GregorianCalendar::getGregorianChange
    765  * @see ucal_setGregorianChange
    766  * @stable ICU 3.6
    767  */
    768 U_STABLE UDate U_EXPORT2
    769 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode);
    770 
    771 /**
    772  * Types of UCalendar attributes
    773  * @stable ICU 2.0
    774  */
    775 enum UCalendarAttribute {
    776     /** Lenient parsing */
    777   UCAL_LENIENT,
    778   /** First day of week */
    779   UCAL_FIRST_DAY_OF_WEEK,
    780   /** Minimum number of days in first week */
    781   UCAL_MINIMAL_DAYS_IN_FIRST_WEEK
    782 };
    783 
    784 /** @stable ICU 2.0 */
    785 typedef enum UCalendarAttribute UCalendarAttribute;
    786 
    787 /**
    788  * Get a numeric attribute associated with a UCalendar.
    789  * Numeric attributes include the first day of the week, or the minimal numbers
    790  * of days in the first week of the month.
    791  * @param cal The UCalendar to query.
    792  * @param attr The desired attribute; one of UCAL_LENIENT, UCAL_FIRST_DAY_OF_WEEK,
    793  * or UCAL_MINIMAL_DAYS_IN_FIRST_WEEK
    794  * @return The value of attr.
    795  * @see ucal_setAttribute
    796  * @stable ICU 2.0
    797  */
    798 U_STABLE int32_t U_EXPORT2
    799 ucal_getAttribute(const UCalendar*    cal,
    800                   UCalendarAttribute  attr);
    801 
    802 /**
    803  * Set a numeric attribute associated with a UCalendar.
    804  * Numeric attributes include the first day of the week, or the minimal numbers
    805  * of days in the first week of the month.
    806  * @param cal The UCalendar to set.
    807  * @param attr The desired attribute; one of UCAL_LENIENT, UCAL_FIRST_DAY_OF_WEEK,
    808  * or UCAL_MINIMAL_DAYS_IN_FIRST_WEEK
    809  * @param newValue The new value of attr.
    810  * @see ucal_getAttribute
    811  * @stable ICU 2.0
    812  */
    813 U_STABLE void U_EXPORT2
    814 ucal_setAttribute(UCalendar*          cal,
    815                   UCalendarAttribute  attr,
    816                   int32_t             newValue);
    817 
    818 /**
    819  * Get a locale for which calendars are available.
    820  * A UCalendar in a locale returned by this function will contain the correct
    821  * day and month names for the locale.
    822  * @param localeIndex The index of the desired locale.
    823  * @return A locale for which calendars are available, or 0 if none.
    824  * @see ucal_countAvailable
    825  * @stable ICU 2.0
    826  */
    827 U_STABLE const char* U_EXPORT2
    828 ucal_getAvailable(int32_t localeIndex);
    829 
    830 /**
    831  * Determine how many locales have calendars available.
    832  * This function is most useful as determining the loop ending condition for
    833  * calls to \ref ucal_getAvailable.
    834  * @return The number of locales for which calendars are available.
    835  * @see ucal_getAvailable
    836  * @stable ICU 2.0
    837  */
    838 U_STABLE int32_t U_EXPORT2
    839 ucal_countAvailable(void);
    840 
    841 /**
    842  * Get a UCalendar's current time in millis.
    843  * The time is represented as milliseconds from the epoch.
    844  * @param cal The UCalendar to query.
    845  * @param status A pointer to an UErrorCode to receive any errors
    846  * @return The calendar's current time in millis.
    847  * @see ucal_setMillis
    848  * @see ucal_setDate
    849  * @see ucal_setDateTime
    850  * @stable ICU 2.0
    851  */
    852 U_STABLE UDate U_EXPORT2
    853 ucal_getMillis(const UCalendar*  cal,
    854                UErrorCode*       status);
    855 
    856 /**
    857  * Set a UCalendar's current time in millis.
    858  * The time is represented as milliseconds from the epoch.
    859  * @param cal The UCalendar to set.
    860  * @param dateTime The desired date and time.
    861  * @param status A pointer to an UErrorCode to receive any errors
    862  * @see ucal_getMillis
    863  * @see ucal_setDate
    864  * @see ucal_setDateTime
    865  * @stable ICU 2.0
    866  */
    867 U_STABLE void U_EXPORT2
    868 ucal_setMillis(UCalendar*   cal,
    869                UDate        dateTime,
    870                UErrorCode*  status );
    871 
    872 /**
    873  * Set a UCalendar's current date.
    874  * The date is represented as a series of 32-bit integers.
    875  * @param cal The UCalendar to set.
    876  * @param year The desired year.
    877  * @param month The desired month; one of UCAL_JANUARY, UCAL_FEBRUARY, UCAL_MARCH, UCAL_APRIL, UCAL_MAY,
    878  * UCAL_JUNE, UCAL_JULY, UCAL_AUGUST, UCAL_SEPTEMBER, UCAL_OCTOBER, UCAL_NOVEMBER, UCAL_DECEMBER, UCAL_UNDECIMBER
    879  * @param date The desired day of the month.
    880  * @param status A pointer to an UErrorCode to receive any errors
    881  * @see ucal_getMillis
    882  * @see ucal_setMillis
    883  * @see ucal_setDateTime
    884  * @stable ICU 2.0
    885  */
    886 U_STABLE void U_EXPORT2
    887 ucal_setDate(UCalendar*   cal,
    888              int32_t      year,
    889              int32_t      month,
    890              int32_t      date,
    891              UErrorCode*  status);
    892 
    893 /**
    894  * Set a UCalendar's current date.
    895  * The date is represented as a series of 32-bit integers.
    896  * @param cal The UCalendar to set.
    897  * @param year The desired year.
    898  * @param month The desired month; one of UCAL_JANUARY, UCAL_FEBRUARY, UCAL_MARCH, UCAL_APRIL, UCAL_MAY,
    899  * UCAL_JUNE, UCAL_JULY, UCAL_AUGUST, UCAL_SEPTEMBER, UCAL_OCTOBER, UCAL_NOVEMBER, UCAL_DECEMBER, UCAL_UNDECIMBER
    900  * @param date The desired day of the month.
    901  * @param hour The desired hour of day.
    902  * @param minute The desired minute.
    903  * @param second The desirec second.
    904  * @param status A pointer to an UErrorCode to receive any errors
    905  * @see ucal_getMillis
    906  * @see ucal_setMillis
    907  * @see ucal_setDate
    908  * @stable ICU 2.0
    909  */
    910 U_STABLE void U_EXPORT2
    911 ucal_setDateTime(UCalendar*   cal,
    912                  int32_t      year,
    913                  int32_t      month,
    914                  int32_t      date,
    915                  int32_t      hour,
    916                  int32_t      minute,
    917                  int32_t      second,
    918                  UErrorCode*  status);
    919 
    920 /**
    921  * Returns TRUE if two UCalendars are equivalent.  Equivalent
    922  * UCalendars will behave identically, but they may be set to
    923  * different times.
    924  * @param cal1 The first of the UCalendars to compare.
    925  * @param cal2 The second of the UCalendars to compare.
    926  * @return TRUE if cal1 and cal2 are equivalent, FALSE otherwise.
    927  * @stable ICU 2.0
    928  */
    929 U_STABLE UBool U_EXPORT2
    930 ucal_equivalentTo(const UCalendar*  cal1,
    931                   const UCalendar*  cal2);
    932 
    933 /**
    934  * Add a specified signed amount to a particular field in a UCalendar.
    935  * This can modify more significant fields in the calendar.
    936  * @param cal The UCalendar to which to add.
    937  * @param field The field to which to add the signed value; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH,
    938  * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK,
    939  * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND,
    940  * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
    941  * @param amount The signed amount to add to field. If the amount causes the value
    942  * to exceed to maximum or minimum values for that field, other fields are modified
    943  * to preserve the magnitude of the change.
    944  * @param status A pointer to an UErrorCode to receive any errors
    945  * @see ucal_roll
    946  * @stable ICU 2.0
    947  */
    948 U_STABLE void U_EXPORT2
    949 ucal_add(UCalendar*           cal,
    950          UCalendarDateFields  field,
    951          int32_t              amount,
    952          UErrorCode*          status);
    953 
    954 /**
    955  * Add a specified signed amount to a particular field in a UCalendar.
    956  * This will not modify more significant fields in the calendar.
    957  * @param cal The UCalendar to which to add.
    958  * @param field The field to which to add the signed value; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH,
    959  * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK,
    960  * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND,
    961  * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
    962  * @param amount The signed amount to add to field. If the amount causes the value
    963  * to exceed to maximum or minimum values for that field, the field is pinned to a permissible
    964  * value.
    965  * @param status A pointer to an UErrorCode to receive any errors
    966  * @see ucal_add
    967  * @stable ICU 2.0
    968  */
    969 U_STABLE void U_EXPORT2
    970 ucal_roll(UCalendar*           cal,
    971           UCalendarDateFields  field,
    972           int32_t              amount,
    973           UErrorCode*          status);
    974 
    975 /**
    976  * Get the current value of a field from a UCalendar.
    977  * All fields are represented as 32-bit integers.
    978  * @param cal The UCalendar to query.
    979  * @param field The desired field; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH,
    980  * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK,
    981  * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND,
    982  * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
    983  * @param status A pointer to an UErrorCode to receive any errors
    984  * @return The value of the desired field.
    985  * @see ucal_set
    986  * @see ucal_isSet
    987  * @see ucal_clearField
    988  * @see ucal_clear
    989  * @stable ICU 2.0
    990  */
    991 U_STABLE int32_t U_EXPORT2
    992 ucal_get(const UCalendar*     cal,
    993          UCalendarDateFields  field,
    994          UErrorCode*          status );
    995 
    996 /**
    997  * Set the value of a field in a UCalendar.
    998  * All fields are represented as 32-bit integers.
    999  * @param cal The UCalendar to set.
   1000  * @param field The field to set; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH,
   1001  * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK,
   1002  * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND,
   1003  * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
   1004  * @param value The desired value of field.
   1005  * @see ucal_get
   1006  * @see ucal_isSet
   1007  * @see ucal_clearField
   1008  * @see ucal_clear
   1009  * @stable ICU 2.0
   1010  */
   1011 U_STABLE void U_EXPORT2
   1012 ucal_set(UCalendar*           cal,
   1013          UCalendarDateFields  field,
   1014          int32_t              value);
   1015 
   1016 /**
   1017  * Determine if a field in a UCalendar is set.
   1018  * All fields are represented as 32-bit integers.
   1019  * @param cal The UCalendar to query.
   1020  * @param field The desired field; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH,
   1021  * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK,
   1022  * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND,
   1023  * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
   1024  * @return TRUE if field is set, FALSE otherwise.
   1025  * @see ucal_get
   1026  * @see ucal_set
   1027  * @see ucal_clearField
   1028  * @see ucal_clear
   1029  * @stable ICU 2.0
   1030  */
   1031 U_STABLE UBool U_EXPORT2
   1032 ucal_isSet(const UCalendar*     cal,
   1033            UCalendarDateFields  field);
   1034 
   1035 /**
   1036  * Clear a field in a UCalendar.
   1037  * All fields are represented as 32-bit integers.
   1038  * @param cal The UCalendar containing the field to clear.
   1039  * @param field The field to clear; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH,
   1040  * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK,
   1041  * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND,
   1042  * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
   1043  * @see ucal_get
   1044  * @see ucal_set
   1045  * @see ucal_isSet
   1046  * @see ucal_clear
   1047  * @stable ICU 2.0
   1048  */
   1049 U_STABLE void U_EXPORT2
   1050 ucal_clearField(UCalendar*           cal,
   1051                 UCalendarDateFields  field);
   1052 
   1053 /**
   1054  * Clear all fields in a UCalendar.
   1055  * All fields are represented as 32-bit integers.
   1056  * @param calendar The UCalendar to clear.
   1057  * @see ucal_get
   1058  * @see ucal_set
   1059  * @see ucal_isSet
   1060  * @see ucal_clearField
   1061  * @stable ICU 2.0
   1062  */
   1063 U_STABLE void U_EXPORT2
   1064 ucal_clear(UCalendar* calendar);
   1065 
   1066 /**
   1067  * Possible limit values for a UCalendar
   1068  * @stable ICU 2.0
   1069  */
   1070 enum UCalendarLimitType {
   1071   /** Minimum value */
   1072   UCAL_MINIMUM,
   1073   /** Maximum value */
   1074   UCAL_MAXIMUM,
   1075   /** Greatest minimum value */
   1076   UCAL_GREATEST_MINIMUM,
   1077   /** Leaest maximum value */
   1078   UCAL_LEAST_MAXIMUM,
   1079   /** Actual minimum value */
   1080   UCAL_ACTUAL_MINIMUM,
   1081   /** Actual maximum value */
   1082   UCAL_ACTUAL_MAXIMUM
   1083 };
   1084 
   1085 /** @stable ICU 2.0 */
   1086 typedef enum UCalendarLimitType UCalendarLimitType;
   1087 
   1088 /**
   1089  * Determine a limit for a field in a UCalendar.
   1090  * A limit is a maximum or minimum value for a field.
   1091  * @param cal The UCalendar to query.
   1092  * @param field The desired field; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH,
   1093  * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK,
   1094  * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND,
   1095  * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
   1096  * @param type The desired critical point; one of UCAL_MINIMUM, UCAL_MAXIMUM, UCAL_GREATEST_MINIMUM,
   1097  * UCAL_LEAST_MAXIMUM, UCAL_ACTUAL_MINIMUM, UCAL_ACTUAL_MAXIMUM
   1098  * @param status A pointer to an UErrorCode to receive any errors.
   1099  * @return The requested value.
   1100  * @stable ICU 2.0
   1101  */
   1102 U_STABLE int32_t U_EXPORT2
   1103 ucal_getLimit(const UCalendar*     cal,
   1104               UCalendarDateFields  field,
   1105               UCalendarLimitType   type,
   1106               UErrorCode*          status);
   1107 
   1108 /** Get the locale for this calendar object. You can choose between valid and actual locale.
   1109  *  @param cal The calendar object
   1110  *  @param type type of the locale we're looking for (valid or actual)
   1111  *  @param status error code for the operation
   1112  *  @return the locale name
   1113  *  @stable ICU 2.8
   1114  */
   1115 U_STABLE const char * U_EXPORT2
   1116 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
   1117 
   1118 /**
   1119  * Returns the timezone data version currently used by ICU.
   1120  * @param status error code for the operation
   1121  * @return the version string, such as "2007f"
   1122  * @stable ICU 3.8
   1123  */
   1124 U_DRAFT const char * U_EXPORT2
   1125 ucal_getTZDataVersion(UErrorCode* status);
   1126 
   1127 /**
   1128  * Returns the canonical system timezone ID or the normalized
   1129  * custom time zone ID for the given time zone ID.
   1130  * @param id        The input timezone ID to be canonicalized.
   1131  * @param len       The length of id, or -1 if null-terminated.
   1132  * @param result    The buffer receives the canonical system timezone ID
   1133  *                  or the custom timezone ID in normalized format.
   1134  * @param resultCapacity    The capacity of the result buffer.
   1135  * @param isSystemID        Receives if the given ID is a known system
   1136      *                      timezone ID.
   1137  * @param status    Recevies the status.  When the given timezone ID
   1138  *                  is neither a known system time zone ID nor a
   1139  *                  valid custom timezone ID, U_ILLEGAL_ARGUMENT_ERROR
   1140  *                  is set.
   1141  * @return          The result string length, not including the terminating
   1142  *                  null.
   1143  * @stable ICU 4.0
   1144  */
   1145 U_DRAFT int32_t U_EXPORT2
   1146 ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len,
   1147                             UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status);
   1148 /**
   1149  * Get the resource keyword value string designating the calendar type for the UCalendar.
   1150  * @param cal The UCalendar to query.
   1151  * @param status The error code for the operation.
   1152  * @return The resource keyword value string.
   1153  * @draft ICU 4.2
   1154  */
   1155 U_DRAFT const char * U_EXPORT2
   1156 ucal_getType(const UCalendar *cal, UErrorCode* status);
   1157 
   1158 /**
   1159  * Given a key and a locale, returns an array of string values in a preferred
   1160  * order that would make a difference. These are all and only those values where
   1161  * the open (creation) of the service with the locale formed from the input locale
   1162  * plus input keyword and that value has different behavior than creation with the
   1163  * input locale alone.
   1164  * @param key           one of the keys supported by this service.  For now, only
   1165  *                      "calendar" is supported.
   1166  * @param locale        the locale
   1167  * @param commonlyUsed  if set to true it will return only commonly used values
   1168  *                      with the given locale in preferred order.  Otherwise,
   1169  *                      it will return all the available values for the locale.
   1170  * @param status error status
   1171  * @return a string enumeration over keyword values for the given key and the locale.
   1172  * @draft ICU 4.2
   1173  */
   1174 U_DRAFT UEnumeration* U_EXPORT2
   1175 ucal_getKeywordValuesForLocale(const char* key,
   1176                                const char* locale,
   1177                                UBool commonlyUsed,
   1178                                UErrorCode* status);
   1179 
   1180 
   1181 #endif /* #if !UCONFIG_NO_FORMATTING */
   1182 
   1183 #endif
   1184