17777dab0Sopenharmony_ci// © 2016 and later: Unicode, Inc. and others. 27777dab0Sopenharmony_ci// License & terms of use: http://www.unicode.org/copyright.html 37777dab0Sopenharmony_ci/* 47777dab0Sopenharmony_ci ******************************************************************************* 57777dab0Sopenharmony_ci * Copyright (C) 1996-2015, International Business Machines Corporation and 67777dab0Sopenharmony_ci * others. All Rights Reserved. 77777dab0Sopenharmony_ci ******************************************************************************* 87777dab0Sopenharmony_ci */ 97777dab0Sopenharmony_ci 107777dab0Sopenharmony_ci#ifndef UCAL_H 117777dab0Sopenharmony_ci#define UCAL_H 127777dab0Sopenharmony_ci 137777dab0Sopenharmony_ci#include "unicode/utypes.h" 147777dab0Sopenharmony_ci#include "unicode/uenum.h" 157777dab0Sopenharmony_ci#include "unicode/uloc.h" 167777dab0Sopenharmony_ci 177777dab0Sopenharmony_ci 187777dab0Sopenharmony_ci#if !UCONFIG_NO_FORMATTING 197777dab0Sopenharmony_ci 207777dab0Sopenharmony_ci/** 217777dab0Sopenharmony_ci * \file 227777dab0Sopenharmony_ci * \brief C API: Calendar 237777dab0Sopenharmony_ci * 247777dab0Sopenharmony_ci * <h2>Calendar C API</h2> 257777dab0Sopenharmony_ci * 267777dab0Sopenharmony_ci * UCalendar C API is used for converting between a <code>UDate</code> object 277777dab0Sopenharmony_ci * and a set of integer fields such as <code>UCAL_YEAR</code>, <code>UCAL_MONTH</code>, 287777dab0Sopenharmony_ci * <code>UCAL_DAY</code>, <code>UCAL_HOUR</code>, and so on. 297777dab0Sopenharmony_ci * (A <code>UDate</code> object represents a specific instant in 307777dab0Sopenharmony_ci * time with millisecond precision. See UDate 317777dab0Sopenharmony_ci * for information about the <code>UDate</code> .) 327777dab0Sopenharmony_ci * 337777dab0Sopenharmony_ci * <p> 347777dab0Sopenharmony_ci * Types of <code>UCalendar</code> interpret a <code>UDate</code> 357777dab0Sopenharmony_ci * according to the rules of a specific calendar system. The C API 367777dab0Sopenharmony_ci * provides the enum UCalendarType with UCAL_TRADITIONAL and 377777dab0Sopenharmony_ci * UCAL_GREGORIAN. 387777dab0Sopenharmony_ci * <p> 397777dab0Sopenharmony_ci * Like other locale-sensitive C API, calendar API provides a 407777dab0Sopenharmony_ci * function, <code>ucal_open()</code>, which returns a pointer to 417777dab0Sopenharmony_ci * <code>UCalendar</code> whose time fields have been initialized 427777dab0Sopenharmony_ci * with the current date and time. We need to specify the type of 437777dab0Sopenharmony_ci * calendar to be opened and the timezoneId. 447777dab0Sopenharmony_ci * \htmlonly<blockquote>\endhtmlonly 457777dab0Sopenharmony_ci * <pre> 467777dab0Sopenharmony_ci * \code 477777dab0Sopenharmony_ci * UCalendar *caldef; 487777dab0Sopenharmony_ci * UChar *tzId; 497777dab0Sopenharmony_ci * UErrorCode status; 507777dab0Sopenharmony_ci * tzId=(UChar*)malloc(sizeof(UChar) * (strlen("PST") +1) ); 517777dab0Sopenharmony_ci * u_uastrcpy(tzId, "PST"); 527777dab0Sopenharmony_ci * caldef=ucal_open(tzID, u_strlen(tzID), NULL, UCAL_TRADITIONAL, &status); 537777dab0Sopenharmony_ci * \endcode 547777dab0Sopenharmony_ci * </pre> 557777dab0Sopenharmony_ci * \htmlonly</blockquote>\endhtmlonly 567777dab0Sopenharmony_ci * 577777dab0Sopenharmony_ci * <p> 587777dab0Sopenharmony_ci * A <code>UCalendar</code> object can produce all the time field values 597777dab0Sopenharmony_ci * needed to implement the date-time formatting for a particular language 607777dab0Sopenharmony_ci * and calendar style (for example, Japanese-Gregorian, Japanese-Traditional). 617777dab0Sopenharmony_ci * 627777dab0Sopenharmony_ci * <p> 637777dab0Sopenharmony_ci * When computing a <code>UDate</code> from time fields, two special circumstances 647777dab0Sopenharmony_ci * may arise: there may be insufficient information to compute the 657777dab0Sopenharmony_ci * <code>UDate</code> (such as only year and month but no day in the month), 667777dab0Sopenharmony_ci * or there may be inconsistent information (such as "Tuesday, July 15, 1996" 677777dab0Sopenharmony_ci * -- July 15, 1996 is actually a Monday). 687777dab0Sopenharmony_ci * 697777dab0Sopenharmony_ci * <p> 707777dab0Sopenharmony_ci * <strong>Insufficient information.</strong> The calendar will use default 717777dab0Sopenharmony_ci * information to specify the missing fields. This may vary by calendar; for 727777dab0Sopenharmony_ci * the Gregorian calendar, the default for a field is the same as that of the 737777dab0Sopenharmony_ci * start of the epoch: i.e., UCAL_YEAR = 1970, UCAL_MONTH = JANUARY, UCAL_DATE = 1, etc. 747777dab0Sopenharmony_ci * 757777dab0Sopenharmony_ci * <p> 767777dab0Sopenharmony_ci * <strong>Inconsistent information.</strong> If fields conflict, the calendar 777777dab0Sopenharmony_ci * will give preference to fields set more recently. For example, when 787777dab0Sopenharmony_ci * determining the day, the calendar will look for one of the following 797777dab0Sopenharmony_ci * combinations of fields. The most recent combination, as determined by the 807777dab0Sopenharmony_ci * most recently set single field, will be used. 817777dab0Sopenharmony_ci * 827777dab0Sopenharmony_ci * \htmlonly<blockquote>\endhtmlonly 837777dab0Sopenharmony_ci * <pre> 847777dab0Sopenharmony_ci * \code 857777dab0Sopenharmony_ci * UCAL_MONTH + UCAL_DAY_OF_MONTH 867777dab0Sopenharmony_ci * UCAL_MONTH + UCAL_WEEK_OF_MONTH + UCAL_DAY_OF_WEEK 877777dab0Sopenharmony_ci * UCAL_MONTH + UCAL_DAY_OF_WEEK_IN_MONTH + UCAL_DAY_OF_WEEK 887777dab0Sopenharmony_ci * UCAL_DAY_OF_YEAR 897777dab0Sopenharmony_ci * UCAL_DAY_OF_WEEK + UCAL_WEEK_OF_YEAR 907777dab0Sopenharmony_ci * \endcode 917777dab0Sopenharmony_ci * </pre> 927777dab0Sopenharmony_ci * \htmlonly</blockquote>\endhtmlonly 937777dab0Sopenharmony_ci * 947777dab0Sopenharmony_ci * For the time of day: 957777dab0Sopenharmony_ci * 967777dab0Sopenharmony_ci * \htmlonly<blockquote>\endhtmlonly 977777dab0Sopenharmony_ci * <pre> 987777dab0Sopenharmony_ci * \code 997777dab0Sopenharmony_ci * UCAL_HOUR_OF_DAY 1007777dab0Sopenharmony_ci * UCAL_AM_PM + UCAL_HOUR 1017777dab0Sopenharmony_ci * \endcode 1027777dab0Sopenharmony_ci * </pre> 1037777dab0Sopenharmony_ci * \htmlonly</blockquote>\endhtmlonly 1047777dab0Sopenharmony_ci * 1057777dab0Sopenharmony_ci * <p> 1067777dab0Sopenharmony_ci * <strong>Note:</strong> for some non-Gregorian calendars, different 1077777dab0Sopenharmony_ci * fields may be necessary for complete disambiguation. For example, a full 1087777dab0Sopenharmony_ci * specification of the historical Arabic astronomical calendar requires year, 1097777dab0Sopenharmony_ci * month, day-of-month <em>and</em> day-of-week in some cases. 1107777dab0Sopenharmony_ci * 1117777dab0Sopenharmony_ci * <p> 1127777dab0Sopenharmony_ci * <strong>Note:</strong> There are certain possible ambiguities in 1137777dab0Sopenharmony_ci * interpretation of certain singular times, which are resolved in the 1147777dab0Sopenharmony_ci * following ways: 1157777dab0Sopenharmony_ci * <ol> 1167777dab0Sopenharmony_ci * <li> 24:00:00 "belongs" to the following day. That is, 1177777dab0Sopenharmony_ci * 23:59 on Dec 31, 1969 < 24:00 on Jan 1, 1970 < 24:01:00 on Jan 1, 1970 1187777dab0Sopenharmony_ci * 1197777dab0Sopenharmony_ci * <li> Although historically not precise, midnight also belongs to "am", 1207777dab0Sopenharmony_ci * and noon belongs to "pm", so on the same day, 1217777dab0Sopenharmony_ci * 12:00 am (midnight) < 12:01 am, and 12:00 pm (noon) < 12:01 pm 1227777dab0Sopenharmony_ci * </ol> 1237777dab0Sopenharmony_ci * 1247777dab0Sopenharmony_ci * <p> 1257777dab0Sopenharmony_ci * The date or time format strings are not part of the definition of a 1267777dab0Sopenharmony_ci * calendar, as those must be modifiable or overridable by the user at 1277777dab0Sopenharmony_ci * runtime. Use {@link icu::DateFormat} 1287777dab0Sopenharmony_ci * to format dates. 1297777dab0Sopenharmony_ci * 1307777dab0Sopenharmony_ci * <p> 1317777dab0Sopenharmony_ci * <code>Calendar</code> provides an API for field "rolling", where fields 1327777dab0Sopenharmony_ci * can be incremented or decremented, but wrap around. For example, rolling the 1337777dab0Sopenharmony_ci * month up in the date <code>December 12, <b>1996</b></code> results in 1347777dab0Sopenharmony_ci * <code>January 12, <b>1996</b></code>. 1357777dab0Sopenharmony_ci * 1367777dab0Sopenharmony_ci * <p> 1377777dab0Sopenharmony_ci * <code>Calendar</code> also provides a date arithmetic function for 1387777dab0Sopenharmony_ci * adding the specified (signed) amount of time to a particular time field. 1397777dab0Sopenharmony_ci * For example, subtracting 5 days from the date <code>September 12, 1996</code> 1407777dab0Sopenharmony_ci * results in <code>September 7, 1996</code>. 1417777dab0Sopenharmony_ci * 1427777dab0Sopenharmony_ci * <p> 1437777dab0Sopenharmony_ci * The Japanese calendar uses a combination of era name and year number. 1447777dab0Sopenharmony_ci * When an emperor of Japan abdicates and a new emperor ascends the throne, 1457777dab0Sopenharmony_ci * a new era is declared and year number is reset to 1. Even if the date of 1467777dab0Sopenharmony_ci * abdication is scheduled ahead of time, the new era name might not be 1477777dab0Sopenharmony_ci * announced until just before the date. In such case, ICU4C may include 1487777dab0Sopenharmony_ci * a start date of future era without actual era name, but not enabled 1497777dab0Sopenharmony_ci * by default. ICU4C users who want to test the behavior of the future era 1507777dab0Sopenharmony_ci * can enable the tentative era by: 1517777dab0Sopenharmony_ci * <ul> 1527777dab0Sopenharmony_ci * <li>Environment variable <code>ICU_ENABLE_TENTATIVE_ERA=true</code>.</li> 1537777dab0Sopenharmony_ci * </ul> 1547777dab0Sopenharmony_ci * 1557777dab0Sopenharmony_ci * @stable ICU 2.0 1567777dab0Sopenharmony_ci */ 1577777dab0Sopenharmony_ci 1587777dab0Sopenharmony_ci/** 1597777dab0Sopenharmony_ci * The time zone ID reserved for unknown time zone. 1607777dab0Sopenharmony_ci * It behaves like the GMT/UTC time zone but has the special ID "Etc/Unknown". 1617777dab0Sopenharmony_ci * @stable ICU 4.8 1627777dab0Sopenharmony_ci */ 1637777dab0Sopenharmony_ci#define UCAL_UNKNOWN_ZONE_ID "Etc/Unknown" 1647777dab0Sopenharmony_ci 1657777dab0Sopenharmony_ci/** A calendar. 1667777dab0Sopenharmony_ci * For usage in C programs. 1677777dab0Sopenharmony_ci * @stable ICU 2.0 1687777dab0Sopenharmony_ci */ 1697777dab0Sopenharmony_citypedef void* UCalendar; 1707777dab0Sopenharmony_ci 1717777dab0Sopenharmony_ci/** Possible types of UCalendars 1727777dab0Sopenharmony_ci * @stable ICU 2.0 1737777dab0Sopenharmony_ci */ 1747777dab0Sopenharmony_cienum UCalendarType { 1757777dab0Sopenharmony_ci /** 1767777dab0Sopenharmony_ci * Despite the name, UCAL_TRADITIONAL designates the locale's default calendar, 1777777dab0Sopenharmony_ci * which may be the Gregorian calendar or some other calendar. 1787777dab0Sopenharmony_ci * @stable ICU 2.0 1797777dab0Sopenharmony_ci */ 1807777dab0Sopenharmony_ci UCAL_TRADITIONAL, 1817777dab0Sopenharmony_ci /** 1827777dab0Sopenharmony_ci * A better name for UCAL_TRADITIONAL. 1837777dab0Sopenharmony_ci * @stable ICU 4.2 1847777dab0Sopenharmony_ci */ 1857777dab0Sopenharmony_ci UCAL_DEFAULT = UCAL_TRADITIONAL, 1867777dab0Sopenharmony_ci /** 1877777dab0Sopenharmony_ci * Unambiguously designates the Gregorian calendar for the locale. 1887777dab0Sopenharmony_ci * @stable ICU 2.0 1897777dab0Sopenharmony_ci */ 1907777dab0Sopenharmony_ci UCAL_GREGORIAN 1917777dab0Sopenharmony_ci}; 1927777dab0Sopenharmony_ci 1937777dab0Sopenharmony_ci/** @stable ICU 2.0 */ 1947777dab0Sopenharmony_citypedef enum UCalendarType UCalendarType; 1957777dab0Sopenharmony_ci 1967777dab0Sopenharmony_ci/** Possible fields in a UCalendar 1977777dab0Sopenharmony_ci * @stable ICU 2.0 1987777dab0Sopenharmony_ci */ 1997777dab0Sopenharmony_cienum UCalendarDateFields { 2007777dab0Sopenharmony_ci /** 2017777dab0Sopenharmony_ci * Field number indicating the era, e.g., AD or BC in the Gregorian (Julian) calendar. 2027777dab0Sopenharmony_ci * This is a calendar-specific value. 2037777dab0Sopenharmony_ci * @stable ICU 2.6 2047777dab0Sopenharmony_ci */ 2057777dab0Sopenharmony_ci UCAL_ERA, 2067777dab0Sopenharmony_ci 2077777dab0Sopenharmony_ci /** 2087777dab0Sopenharmony_ci * Field number indicating the year. This is a calendar-specific value. 2097777dab0Sopenharmony_ci * @stable ICU 2.6 2107777dab0Sopenharmony_ci */ 2117777dab0Sopenharmony_ci UCAL_YEAR, 2127777dab0Sopenharmony_ci 2137777dab0Sopenharmony_ci /** 2147777dab0Sopenharmony_ci * Field number indicating the month. This is a calendar-specific value. 2157777dab0Sopenharmony_ci * The first month of the year is 2167777dab0Sopenharmony_ci * <code>JANUARY</code>; the last depends on the number of months in a year. 2177777dab0Sopenharmony_ci * @see #UCAL_JANUARY 2187777dab0Sopenharmony_ci * @see #UCAL_FEBRUARY 2197777dab0Sopenharmony_ci * @see #UCAL_MARCH 2207777dab0Sopenharmony_ci * @see #UCAL_APRIL 2217777dab0Sopenharmony_ci * @see #UCAL_MAY 2227777dab0Sopenharmony_ci * @see #UCAL_JUNE 2237777dab0Sopenharmony_ci * @see #UCAL_JULY 2247777dab0Sopenharmony_ci * @see #UCAL_AUGUST 2257777dab0Sopenharmony_ci * @see #UCAL_SEPTEMBER 2267777dab0Sopenharmony_ci * @see #UCAL_OCTOBER 2277777dab0Sopenharmony_ci * @see #UCAL_NOVEMBER 2287777dab0Sopenharmony_ci * @see #UCAL_DECEMBER 2297777dab0Sopenharmony_ci * @see #UCAL_UNDECIMBER 2307777dab0Sopenharmony_ci * @stable ICU 2.6 2317777dab0Sopenharmony_ci */ 2327777dab0Sopenharmony_ci UCAL_MONTH, 2337777dab0Sopenharmony_ci 2347777dab0Sopenharmony_ci /** 2357777dab0Sopenharmony_ci * Field number indicating the 2367777dab0Sopenharmony_ci * week number within the current year. The first week of the year, as 2377777dab0Sopenharmony_ci * defined by <code>UCAL_FIRST_DAY_OF_WEEK</code> and <code>UCAL_MINIMAL_DAYS_IN_FIRST_WEEK</code> 2387777dab0Sopenharmony_ci * attributes, has value 1. Subclasses define 2397777dab0Sopenharmony_ci * the value of <code>UCAL_WEEK_OF_YEAR</code> for days before the first week of 2407777dab0Sopenharmony_ci * the year. 2417777dab0Sopenharmony_ci * @see ucal_getAttribute 2427777dab0Sopenharmony_ci * @see ucal_setAttribute 2437777dab0Sopenharmony_ci * @stable ICU 2.6 2447777dab0Sopenharmony_ci */ 2457777dab0Sopenharmony_ci UCAL_WEEK_OF_YEAR, 2467777dab0Sopenharmony_ci 2477777dab0Sopenharmony_ci /** 2487777dab0Sopenharmony_ci * Field number indicating the 2497777dab0Sopenharmony_ci * week number within the current month. The first week of the month, as 2507777dab0Sopenharmony_ci * defined by <code>UCAL_FIRST_DAY_OF_WEEK</code> and <code>UCAL_MINIMAL_DAYS_IN_FIRST_WEEK</code> 2517777dab0Sopenharmony_ci * attributes, has value 1. Subclasses define 2527777dab0Sopenharmony_ci * the value of <code>WEEK_OF_MONTH</code> for days before the first week of 2537777dab0Sopenharmony_ci * the month. 2547777dab0Sopenharmony_ci * @see ucal_getAttribute 2557777dab0Sopenharmony_ci * @see ucal_setAttribute 2567777dab0Sopenharmony_ci * @see #UCAL_FIRST_DAY_OF_WEEK 2577777dab0Sopenharmony_ci * @see #UCAL_MINIMAL_DAYS_IN_FIRST_WEEK 2587777dab0Sopenharmony_ci * @stable ICU 2.6 2597777dab0Sopenharmony_ci */ 2607777dab0Sopenharmony_ci UCAL_WEEK_OF_MONTH, 2617777dab0Sopenharmony_ci 2627777dab0Sopenharmony_ci /** 2637777dab0Sopenharmony_ci * Field number indicating the 2647777dab0Sopenharmony_ci * day of the month. This is a synonym for <code>DAY_OF_MONTH</code>. 2657777dab0Sopenharmony_ci * The first day of the month has value 1. 2667777dab0Sopenharmony_ci * @see #UCAL_DAY_OF_MONTH 2677777dab0Sopenharmony_ci * @stable ICU 2.6 2687777dab0Sopenharmony_ci */ 2697777dab0Sopenharmony_ci UCAL_DATE, 2707777dab0Sopenharmony_ci 2717777dab0Sopenharmony_ci /** 2727777dab0Sopenharmony_ci * Field number indicating the day 2737777dab0Sopenharmony_ci * number within the current year. The first day of the year has value 1. 2747777dab0Sopenharmony_ci * @stable ICU 2.6 2757777dab0Sopenharmony_ci */ 2767777dab0Sopenharmony_ci UCAL_DAY_OF_YEAR, 2777777dab0Sopenharmony_ci 2787777dab0Sopenharmony_ci /** 2797777dab0Sopenharmony_ci * Field number indicating the day 2807777dab0Sopenharmony_ci * of the week. This field takes values <code>SUNDAY</code>, 2817777dab0Sopenharmony_ci * <code>MONDAY</code>, <code>TUESDAY</code>, <code>WEDNESDAY</code>, 2827777dab0Sopenharmony_ci * <code>THURSDAY</code>, <code>FRIDAY</code>, and <code>SATURDAY</code>. 2837777dab0Sopenharmony_ci * @see #UCAL_SUNDAY 2847777dab0Sopenharmony_ci * @see #UCAL_MONDAY 2857777dab0Sopenharmony_ci * @see #UCAL_TUESDAY 2867777dab0Sopenharmony_ci * @see #UCAL_WEDNESDAY 2877777dab0Sopenharmony_ci * @see #UCAL_THURSDAY 2887777dab0Sopenharmony_ci * @see #UCAL_FRIDAY 2897777dab0Sopenharmony_ci * @see #UCAL_SATURDAY 2907777dab0Sopenharmony_ci * @stable ICU 2.6 2917777dab0Sopenharmony_ci */ 2927777dab0Sopenharmony_ci UCAL_DAY_OF_WEEK, 2937777dab0Sopenharmony_ci 2947777dab0Sopenharmony_ci /** 2957777dab0Sopenharmony_ci * Field number indicating the 2967777dab0Sopenharmony_ci * ordinal number of the day of the week within the current month. Together 2977777dab0Sopenharmony_ci * with the <code>DAY_OF_WEEK</code> field, this uniquely specifies a day 2987777dab0Sopenharmony_ci * within a month. Unlike <code>WEEK_OF_MONTH</code> and 2997777dab0Sopenharmony_ci * <code>WEEK_OF_YEAR</code>, this field's value does <em>not</em> depend on 3007777dab0Sopenharmony_ci * <code>getFirstDayOfWeek()</code> or 3017777dab0Sopenharmony_ci * <code>getMinimalDaysInFirstWeek()</code>. <code>DAY_OF_MONTH 1</code> 3027777dab0Sopenharmony_ci * through <code>7</code> always correspond to <code>DAY_OF_WEEK_IN_MONTH 3037777dab0Sopenharmony_ci * 1</code>; <code>8</code> through <code>15</code> correspond to 3047777dab0Sopenharmony_ci * <code>DAY_OF_WEEK_IN_MONTH 2</code>, and so on. 3057777dab0Sopenharmony_ci * <code>DAY_OF_WEEK_IN_MONTH 0</code> indicates the week before 3067777dab0Sopenharmony_ci * <code>DAY_OF_WEEK_IN_MONTH 1</code>. Negative values count back from the 3077777dab0Sopenharmony_ci * end of the month, so the last Sunday of a month is specified as 3087777dab0Sopenharmony_ci * <code>DAY_OF_WEEK = SUNDAY, DAY_OF_WEEK_IN_MONTH = -1</code>. Because 3097777dab0Sopenharmony_ci * negative values count backward they will usually be aligned differently 3107777dab0Sopenharmony_ci * within the month than positive values. For example, if a month has 31 3117777dab0Sopenharmony_ci * days, <code>DAY_OF_WEEK_IN_MONTH -1</code> will overlap 3127777dab0Sopenharmony_ci * <code>DAY_OF_WEEK_IN_MONTH 5</code> and the end of <code>4</code>. 3137777dab0Sopenharmony_ci * @see #UCAL_DAY_OF_WEEK 3147777dab0Sopenharmony_ci * @see #UCAL_WEEK_OF_MONTH 3157777dab0Sopenharmony_ci * @stable ICU 2.6 3167777dab0Sopenharmony_ci */ 3177777dab0Sopenharmony_ci UCAL_DAY_OF_WEEK_IN_MONTH, 3187777dab0Sopenharmony_ci 3197777dab0Sopenharmony_ci /** 3207777dab0Sopenharmony_ci * Field number indicating 3217777dab0Sopenharmony_ci * whether the <code>HOUR</code> is before or after noon. 3227777dab0Sopenharmony_ci * E.g., at 10:04:15.250 PM the <code>AM_PM</code> is <code>PM</code>. 3237777dab0Sopenharmony_ci * @see #UCAL_AM 3247777dab0Sopenharmony_ci * @see #UCAL_PM 3257777dab0Sopenharmony_ci * @see #UCAL_HOUR 3267777dab0Sopenharmony_ci * @stable ICU 2.6 3277777dab0Sopenharmony_ci */ 3287777dab0Sopenharmony_ci UCAL_AM_PM, 3297777dab0Sopenharmony_ci 3307777dab0Sopenharmony_ci /** 3317777dab0Sopenharmony_ci * Field number indicating the 3327777dab0Sopenharmony_ci * hour of the morning or afternoon. <code>HOUR</code> is used for the 12-hour 3337777dab0Sopenharmony_ci * clock. 3347777dab0Sopenharmony_ci * E.g., at 10:04:15.250 PM the <code>HOUR</code> is 10. 3357777dab0Sopenharmony_ci * @see #UCAL_AM_PM 3367777dab0Sopenharmony_ci * @see #UCAL_HOUR_OF_DAY 3377777dab0Sopenharmony_ci * @stable ICU 2.6 3387777dab0Sopenharmony_ci */ 3397777dab0Sopenharmony_ci UCAL_HOUR, 3407777dab0Sopenharmony_ci 3417777dab0Sopenharmony_ci /** 3427777dab0Sopenharmony_ci * Field number indicating the 3437777dab0Sopenharmony_ci * hour of the day. <code>HOUR_OF_DAY</code> is used for the 24-hour clock. 3447777dab0Sopenharmony_ci * E.g., at 10:04:15.250 PM the <code>HOUR_OF_DAY</code> is 22. 3457777dab0Sopenharmony_ci * @see #UCAL_HOUR 3467777dab0Sopenharmony_ci * @stable ICU 2.6 3477777dab0Sopenharmony_ci */ 3487777dab0Sopenharmony_ci UCAL_HOUR_OF_DAY, 3497777dab0Sopenharmony_ci 3507777dab0Sopenharmony_ci /** 3517777dab0Sopenharmony_ci * Field number indicating the 3527777dab0Sopenharmony_ci * minute within the hour. 3537777dab0Sopenharmony_ci * E.g., at 10:04:15.250 PM the <code>UCAL_MINUTE</code> is 4. 3547777dab0Sopenharmony_ci * @stable ICU 2.6 3557777dab0Sopenharmony_ci */ 3567777dab0Sopenharmony_ci UCAL_MINUTE, 3577777dab0Sopenharmony_ci 3587777dab0Sopenharmony_ci /** 3597777dab0Sopenharmony_ci * Field number indicating the 3607777dab0Sopenharmony_ci * second within the minute. 3617777dab0Sopenharmony_ci * E.g., at 10:04:15.250 PM the <code>UCAL_SECOND</code> is 15. 3627777dab0Sopenharmony_ci * @stable ICU 2.6 3637777dab0Sopenharmony_ci */ 3647777dab0Sopenharmony_ci UCAL_SECOND, 3657777dab0Sopenharmony_ci 3667777dab0Sopenharmony_ci /** 3677777dab0Sopenharmony_ci * Field number indicating the 3687777dab0Sopenharmony_ci * millisecond within the second. 3697777dab0Sopenharmony_ci * E.g., at 10:04:15.250 PM the <code>UCAL_MILLISECOND</code> is 250. 3707777dab0Sopenharmony_ci * @stable ICU 2.6 3717777dab0Sopenharmony_ci */ 3727777dab0Sopenharmony_ci UCAL_MILLISECOND, 3737777dab0Sopenharmony_ci 3747777dab0Sopenharmony_ci /** 3757777dab0Sopenharmony_ci * Field number indicating the 3767777dab0Sopenharmony_ci * raw offset from GMT in milliseconds. 3777777dab0Sopenharmony_ci * @stable ICU 2.6 3787777dab0Sopenharmony_ci */ 3797777dab0Sopenharmony_ci UCAL_ZONE_OFFSET, 3807777dab0Sopenharmony_ci 3817777dab0Sopenharmony_ci /** 3827777dab0Sopenharmony_ci * Field number indicating the 3837777dab0Sopenharmony_ci * daylight savings offset in milliseconds. 3847777dab0Sopenharmony_ci * @stable ICU 2.6 3857777dab0Sopenharmony_ci */ 3867777dab0Sopenharmony_ci UCAL_DST_OFFSET, 3877777dab0Sopenharmony_ci 3887777dab0Sopenharmony_ci /** 3897777dab0Sopenharmony_ci * Field number 3907777dab0Sopenharmony_ci * indicating the extended year corresponding to the 3917777dab0Sopenharmony_ci * <code>UCAL_WEEK_OF_YEAR</code> field. This may be one greater or less 3927777dab0Sopenharmony_ci * than the value of <code>UCAL_EXTENDED_YEAR</code>. 3937777dab0Sopenharmony_ci * @stable ICU 2.6 3947777dab0Sopenharmony_ci */ 3957777dab0Sopenharmony_ci UCAL_YEAR_WOY, 3967777dab0Sopenharmony_ci 3977777dab0Sopenharmony_ci /** 3987777dab0Sopenharmony_ci * Field number 3997777dab0Sopenharmony_ci * indicating the localized day of week. This will be a value from 1 4007777dab0Sopenharmony_ci * to 7 inclusive, with 1 being the localized first day of the week. 4017777dab0Sopenharmony_ci * @stable ICU 2.6 4027777dab0Sopenharmony_ci */ 4037777dab0Sopenharmony_ci UCAL_DOW_LOCAL, 4047777dab0Sopenharmony_ci 4057777dab0Sopenharmony_ci /** 4067777dab0Sopenharmony_ci * Year of this calendar system, encompassing all supra-year fields. For example, 4077777dab0Sopenharmony_ci * in Gregorian/Julian calendars, positive Extended Year values indicate years AD, 4087777dab0Sopenharmony_ci * 1 BC = 0 extended, 2 BC = -1 extended, and so on. 4097777dab0Sopenharmony_ci * @stable ICU 2.8 4107777dab0Sopenharmony_ci */ 4117777dab0Sopenharmony_ci UCAL_EXTENDED_YEAR, 4127777dab0Sopenharmony_ci 4137777dab0Sopenharmony_ci /** 4147777dab0Sopenharmony_ci * Field number 4157777dab0Sopenharmony_ci * indicating the modified Julian day number. This is different from 4167777dab0Sopenharmony_ci * the conventional Julian day number in two regards. First, it 4177777dab0Sopenharmony_ci * demarcates days at local zone midnight, rather than noon GMT. 4187777dab0Sopenharmony_ci * Second, it is a local number; that is, it depends on the local time 4197777dab0Sopenharmony_ci * zone. It can be thought of as a single number that encompasses all 4207777dab0Sopenharmony_ci * the date-related fields. 4217777dab0Sopenharmony_ci * @stable ICU 2.8 4227777dab0Sopenharmony_ci */ 4237777dab0Sopenharmony_ci UCAL_JULIAN_DAY, 4247777dab0Sopenharmony_ci 4257777dab0Sopenharmony_ci /** 4267777dab0Sopenharmony_ci * Ranges from 0 to 23:59:59.999 (regardless of DST). This field behaves <em>exactly</em> 4277777dab0Sopenharmony_ci * like a composite of all time-related fields, not including the zone fields. As such, 4287777dab0Sopenharmony_ci * it also reflects discontinuities of those fields on DST transition days. On a day 4297777dab0Sopenharmony_ci * of DST onset, it will jump forward. On a day of DST cessation, it will jump 4307777dab0Sopenharmony_ci * backward. This reflects the fact that it must be combined with the DST_OFFSET field 4317777dab0Sopenharmony_ci * to obtain a unique local time value. 4327777dab0Sopenharmony_ci * @stable ICU 2.8 4337777dab0Sopenharmony_ci */ 4347777dab0Sopenharmony_ci UCAL_MILLISECONDS_IN_DAY, 4357777dab0Sopenharmony_ci 4367777dab0Sopenharmony_ci /** 4377777dab0Sopenharmony_ci * Whether or not the current month is a leap month (0 or 1). See the Chinese calendar for 4387777dab0Sopenharmony_ci * an example of this. 4397777dab0Sopenharmony_ci */ 4407777dab0Sopenharmony_ci UCAL_IS_LEAP_MONTH, 4417777dab0Sopenharmony_ci 4427777dab0Sopenharmony_ci /** 4437777dab0Sopenharmony_ci * Field number indicating the 4447777dab0Sopenharmony_ci * day of the month. This is a synonym for <code>UCAL_DATE</code>. 4457777dab0Sopenharmony_ci * The first day of the month has value 1. 4467777dab0Sopenharmony_ci * @see #UCAL_DATE 4477777dab0Sopenharmony_ci * Synonym for UCAL_DATE 4487777dab0Sopenharmony_ci * @stable ICU 2.8 4497777dab0Sopenharmony_ci **/ 4507777dab0Sopenharmony_ci UCAL_DAY_OF_MONTH=UCAL_DATE 4517777dab0Sopenharmony_ci}; 4527777dab0Sopenharmony_ci 4537777dab0Sopenharmony_ci/** @stable ICU 2.0 */ 4547777dab0Sopenharmony_citypedef enum UCalendarDateFields UCalendarDateFields; 4557777dab0Sopenharmony_ci /** 4567777dab0Sopenharmony_ci * Useful constant for days of week. Note: Calendar day-of-week is 1-based. Clients 4577777dab0Sopenharmony_ci * who create locale resources for the field of first-day-of-week should be aware of 4587777dab0Sopenharmony_ci * this. For instance, in US locale, first-day-of-week is set to 1, i.e., UCAL_SUNDAY. 4597777dab0Sopenharmony_ci */ 4607777dab0Sopenharmony_ci/** Possible days of the week in a UCalendar 4617777dab0Sopenharmony_ci * @stable ICU 2.0 4627777dab0Sopenharmony_ci */ 4637777dab0Sopenharmony_cienum UCalendarDaysOfWeek { 4647777dab0Sopenharmony_ci /** Sunday */ 4657777dab0Sopenharmony_ci UCAL_SUNDAY = 1, 4667777dab0Sopenharmony_ci /** Monday */ 4677777dab0Sopenharmony_ci UCAL_MONDAY, 4687777dab0Sopenharmony_ci /** Tuesday */ 4697777dab0Sopenharmony_ci UCAL_TUESDAY, 4707777dab0Sopenharmony_ci /** Wednesday */ 4717777dab0Sopenharmony_ci UCAL_WEDNESDAY, 4727777dab0Sopenharmony_ci /** Thursday */ 4737777dab0Sopenharmony_ci UCAL_THURSDAY, 4747777dab0Sopenharmony_ci /** Friday */ 4757777dab0Sopenharmony_ci UCAL_FRIDAY, 4767777dab0Sopenharmony_ci /** Saturday */ 4777777dab0Sopenharmony_ci UCAL_SATURDAY 4787777dab0Sopenharmony_ci}; 4797777dab0Sopenharmony_ci 4807777dab0Sopenharmony_ci/** @stable ICU 2.0 */ 4817777dab0Sopenharmony_citypedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek; 4827777dab0Sopenharmony_ci 4837777dab0Sopenharmony_ci/** Possible months in a UCalendar. Note: Calendar month is 0-based. 4847777dab0Sopenharmony_ci * @stable ICU 2.0 4857777dab0Sopenharmony_ci */ 4867777dab0Sopenharmony_cienum UCalendarMonths { 4877777dab0Sopenharmony_ci /** January */ 4887777dab0Sopenharmony_ci UCAL_JANUARY, 4897777dab0Sopenharmony_ci /** February */ 4907777dab0Sopenharmony_ci UCAL_FEBRUARY, 4917777dab0Sopenharmony_ci /** March */ 4927777dab0Sopenharmony_ci UCAL_MARCH, 4937777dab0Sopenharmony_ci /** April */ 4947777dab0Sopenharmony_ci UCAL_APRIL, 4957777dab0Sopenharmony_ci /** May */ 4967777dab0Sopenharmony_ci UCAL_MAY, 4977777dab0Sopenharmony_ci /** June */ 4987777dab0Sopenharmony_ci UCAL_JUNE, 4997777dab0Sopenharmony_ci /** July */ 5007777dab0Sopenharmony_ci UCAL_JULY, 5017777dab0Sopenharmony_ci /** August */ 5027777dab0Sopenharmony_ci UCAL_AUGUST, 5037777dab0Sopenharmony_ci /** September */ 5047777dab0Sopenharmony_ci UCAL_SEPTEMBER, 5057777dab0Sopenharmony_ci /** October */ 5067777dab0Sopenharmony_ci UCAL_OCTOBER, 5077777dab0Sopenharmony_ci /** November */ 5087777dab0Sopenharmony_ci UCAL_NOVEMBER, 5097777dab0Sopenharmony_ci /** December */ 5107777dab0Sopenharmony_ci UCAL_DECEMBER, 5117777dab0Sopenharmony_ci /** Value of the <code>UCAL_MONTH</code> field indicating the 5127777dab0Sopenharmony_ci * thirteenth month of the year. Although the Gregorian calendar 5137777dab0Sopenharmony_ci * does not use this value, lunar calendars do. 5147777dab0Sopenharmony_ci */ 5157777dab0Sopenharmony_ci UCAL_UNDECIMBER 5167777dab0Sopenharmony_ci}; 5177777dab0Sopenharmony_ci 5187777dab0Sopenharmony_ci/** @stable ICU 2.0 */ 5197777dab0Sopenharmony_citypedef enum UCalendarMonths UCalendarMonths; 5207777dab0Sopenharmony_ci 5217777dab0Sopenharmony_ci/** Possible AM/PM values in a UCalendar 5227777dab0Sopenharmony_ci * @stable ICU 2.0 5237777dab0Sopenharmony_ci */ 5247777dab0Sopenharmony_cienum UCalendarAMPMs { 5257777dab0Sopenharmony_ci /** AM */ 5267777dab0Sopenharmony_ci UCAL_AM, 5277777dab0Sopenharmony_ci /** PM */ 5287777dab0Sopenharmony_ci UCAL_PM 5297777dab0Sopenharmony_ci}; 5307777dab0Sopenharmony_ci 5317777dab0Sopenharmony_ci/** @stable ICU 2.0 */ 5327777dab0Sopenharmony_citypedef enum UCalendarAMPMs UCalendarAMPMs; 5337777dab0Sopenharmony_ci 5347777dab0Sopenharmony_ci/** 5357777dab0Sopenharmony_ci * System time zone type constants used by filtering zones 5367777dab0Sopenharmony_ci * in ucal_openTimeZoneIDEnumeration. 5377777dab0Sopenharmony_ci * @see ucal_openTimeZoneIDEnumeration 5387777dab0Sopenharmony_ci * @stable ICU 4.8 5397777dab0Sopenharmony_ci */ 5407777dab0Sopenharmony_cienum USystemTimeZoneType { 5417777dab0Sopenharmony_ci /** 5427777dab0Sopenharmony_ci * Any system zones. 5437777dab0Sopenharmony_ci * @stable ICU 4.8 5447777dab0Sopenharmony_ci */ 5457777dab0Sopenharmony_ci UCAL_ZONE_TYPE_ANY, 5467777dab0Sopenharmony_ci /** 5477777dab0Sopenharmony_ci * Canonical system zones. 5487777dab0Sopenharmony_ci * @stable ICU 4.8 5497777dab0Sopenharmony_ci */ 5507777dab0Sopenharmony_ci UCAL_ZONE_TYPE_CANONICAL, 5517777dab0Sopenharmony_ci /** 5527777dab0Sopenharmony_ci * Canonical system zones associated with actual locations. 5537777dab0Sopenharmony_ci * @stable ICU 4.8 5547777dab0Sopenharmony_ci */ 5557777dab0Sopenharmony_ci UCAL_ZONE_TYPE_CANONICAL_LOCATION 5567777dab0Sopenharmony_ci}; 5577777dab0Sopenharmony_ci 5587777dab0Sopenharmony_ci/** @stable ICU 4.8 */ 5597777dab0Sopenharmony_citypedef enum USystemTimeZoneType USystemTimeZoneType; 5607777dab0Sopenharmony_ci 5617777dab0Sopenharmony_ci/** 5627777dab0Sopenharmony_ci * Create an enumeration over system time zone IDs with the given 5637777dab0Sopenharmony_ci * filter conditions. 5647777dab0Sopenharmony_ci * @param zoneType The system time zone type. 5657777dab0Sopenharmony_ci * @param region The ISO 3166 two-letter country code or UN M.49 5667777dab0Sopenharmony_ci * three-digit area code. When NULL, no filtering 5677777dab0Sopenharmony_ci * done by region. 5687777dab0Sopenharmony_ci * @param rawOffset An offset from GMT in milliseconds, ignoring the 5697777dab0Sopenharmony_ci * effect of daylight savings time, if any. When NULL, 5707777dab0Sopenharmony_ci * no filtering done by zone offset. 5717777dab0Sopenharmony_ci * @param ec A pointer to an UErrorCode to receive any errors 5727777dab0Sopenharmony_ci * @return an enumeration object that the caller must dispose of 5737777dab0Sopenharmony_ci * using enum_close(), or NULL upon failure. In case of failure, 5747777dab0Sopenharmony_ci * *ec will indicate the error. 5757777dab0Sopenharmony_ci * @stable ICU 4.8 5767777dab0Sopenharmony_ci */ 5777777dab0Sopenharmony_ciU_CAPI UEnumeration* U_EXPORT2 5787777dab0Sopenharmony_ciucal_openTimeZoneIDEnumeration(USystemTimeZoneType zoneType, const char* region, 5797777dab0Sopenharmony_ci const int32_t* rawOffset, UErrorCode* ec); 5807777dab0Sopenharmony_ci 5817777dab0Sopenharmony_ci/** 5827777dab0Sopenharmony_ci * Create an enumeration over all time zones. 5837777dab0Sopenharmony_ci * 5847777dab0Sopenharmony_ci * @param ec input/output error code 5857777dab0Sopenharmony_ci * 5867777dab0Sopenharmony_ci * @return an enumeration object that the caller must dispose of using 5877777dab0Sopenharmony_ci * uenum_close(), or NULL upon failure. In case of failure *ec will 5887777dab0Sopenharmony_ci * indicate the error. 5897777dab0Sopenharmony_ci * 5907777dab0Sopenharmony_ci * @stable ICU 2.6 5917777dab0Sopenharmony_ci */ 5927777dab0Sopenharmony_ciU_CAPI UEnumeration* U_EXPORT2 5937777dab0Sopenharmony_ciucal_openTimeZones(UErrorCode* ec); 5947777dab0Sopenharmony_ci 5957777dab0Sopenharmony_ci/** 5967777dab0Sopenharmony_ci * Create an enumeration over all time zones associated with the given 5977777dab0Sopenharmony_ci * country. Some zones are affiliated with no country (e.g., "UTC"); 5987777dab0Sopenharmony_ci * these may also be retrieved, as a group. 5997777dab0Sopenharmony_ci * 6007777dab0Sopenharmony_ci * @param country the ISO 3166 two-letter country code, or NULL to 6017777dab0Sopenharmony_ci * retrieve zones not affiliated with any country 6027777dab0Sopenharmony_ci * 6037777dab0Sopenharmony_ci * @param ec input/output error code 6047777dab0Sopenharmony_ci * 6057777dab0Sopenharmony_ci * @return an enumeration object that the caller must dispose of using 6067777dab0Sopenharmony_ci * uenum_close(), or NULL upon failure. In case of failure *ec will 6077777dab0Sopenharmony_ci * indicate the error. 6087777dab0Sopenharmony_ci * 6097777dab0Sopenharmony_ci * @stable ICU 2.6 6107777dab0Sopenharmony_ci */ 6117777dab0Sopenharmony_ciU_CAPI UEnumeration* U_EXPORT2 6127777dab0Sopenharmony_ciucal_openCountryTimeZones(const char* country, UErrorCode* ec); 6137777dab0Sopenharmony_ci 6147777dab0Sopenharmony_ci/** 6157777dab0Sopenharmony_ci * Return the default time zone. The default is determined initially 6167777dab0Sopenharmony_ci * by querying the host operating system. If the host system detection 6177777dab0Sopenharmony_ci * routines fail, or if they specify a TimeZone or TimeZone offset 6187777dab0Sopenharmony_ci * which is not recognized, then the special TimeZone "Etc/Unknown" 6197777dab0Sopenharmony_ci * is returned. 6207777dab0Sopenharmony_ci * 6217777dab0Sopenharmony_ci * The default may be changed with `ucal_setDefaultTimeZone()` or with 6227777dab0Sopenharmony_ci * the C++ TimeZone API, `TimeZone::adoptDefault(TimeZone*)`. 6237777dab0Sopenharmony_ci * 6247777dab0Sopenharmony_ci * @param result A buffer to receive the result, or NULL 6257777dab0Sopenharmony_ci * 6267777dab0Sopenharmony_ci * @param resultCapacity The capacity of the result buffer 6277777dab0Sopenharmony_ci * 6287777dab0Sopenharmony_ci * @param ec input/output error code 6297777dab0Sopenharmony_ci * 6307777dab0Sopenharmony_ci * @return The result string length, not including the terminating 6317777dab0Sopenharmony_ci * null 6327777dab0Sopenharmony_ci * 6337777dab0Sopenharmony_ci * @see #UCAL_UNKNOWN_ZONE_ID 6347777dab0Sopenharmony_ci * 6357777dab0Sopenharmony_ci * @stable ICU 2.6 6367777dab0Sopenharmony_ci */ 6377777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 6387777dab0Sopenharmony_ciucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec); 6397777dab0Sopenharmony_ci 6407777dab0Sopenharmony_ci/** 6417777dab0Sopenharmony_ci * Set the default time zone. 6427777dab0Sopenharmony_ci * 6437777dab0Sopenharmony_ci * @param zoneID null-terminated time zone ID 6447777dab0Sopenharmony_ci * 6457777dab0Sopenharmony_ci * @param ec input/output error code 6467777dab0Sopenharmony_ci * 6477777dab0Sopenharmony_ci * @stable ICU 2.6 6487777dab0Sopenharmony_ci */ 6497777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 6507777dab0Sopenharmony_ciucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec); 6517777dab0Sopenharmony_ci 6527777dab0Sopenharmony_ci/** 6537777dab0Sopenharmony_ci * Return the current host time zone. The host time zone is detected from 6547777dab0Sopenharmony_ci * the current host system configuration by querying the host operating 6557777dab0Sopenharmony_ci * system. If the host system detection routines fail, or if they specify 6567777dab0Sopenharmony_ci * a TimeZone or TimeZone offset which is not recognized, then the special 6577777dab0Sopenharmony_ci * TimeZone "Etc/Unknown" is returned. 6587777dab0Sopenharmony_ci * 6597777dab0Sopenharmony_ci * Note that host time zone and the ICU default time zone can be different. 6607777dab0Sopenharmony_ci * 6617777dab0Sopenharmony_ci * The ICU default time zone does not change once initialized unless modified 6627777dab0Sopenharmony_ci * by calling `ucal_setDefaultTimeZone()` or with the C++ TimeZone API, 6637777dab0Sopenharmony_ci * `TimeZone::adoptDefault(TimeZone*)`. 6647777dab0Sopenharmony_ci * 6657777dab0Sopenharmony_ci * If the host operating system configuration has changed since ICU has 6667777dab0Sopenharmony_ci * initialized then the returned value can be different than the ICU default 6677777dab0Sopenharmony_ci * time zone, even if the default has not changed. 6687777dab0Sopenharmony_ci * 6697777dab0Sopenharmony_ci * <p>This function is not thread safe.</p> 6707777dab0Sopenharmony_ci * 6717777dab0Sopenharmony_ci * @param result A buffer to receive the result, or NULL 6727777dab0Sopenharmony_ci * @param resultCapacity The capacity of the result buffer 6737777dab0Sopenharmony_ci * @param ec input/output error code 6747777dab0Sopenharmony_ci * @return The result string length, not including the terminating 6757777dab0Sopenharmony_ci * null 6767777dab0Sopenharmony_ci * 6777777dab0Sopenharmony_ci * @see #UCAL_UNKNOWN_ZONE_ID 6787777dab0Sopenharmony_ci * 6797777dab0Sopenharmony_ci * @stable ICU 65 6807777dab0Sopenharmony_ci */ 6817777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 6827777dab0Sopenharmony_ciucal_getHostTimeZone(UChar *result, int32_t resultCapacity, UErrorCode *ec); 6837777dab0Sopenharmony_ci 6847777dab0Sopenharmony_ci/** 6857777dab0Sopenharmony_ci * Return the amount of time in milliseconds that the clock is 6867777dab0Sopenharmony_ci * advanced during daylight savings time for the given time zone, or 6877777dab0Sopenharmony_ci * zero if the time zone does not observe daylight savings time. 6887777dab0Sopenharmony_ci * 6897777dab0Sopenharmony_ci * @param zoneID null-terminated time zone ID 6907777dab0Sopenharmony_ci * 6917777dab0Sopenharmony_ci * @param ec input/output error code 6927777dab0Sopenharmony_ci * 6937777dab0Sopenharmony_ci * @return the number of milliseconds the time is advanced with 6947777dab0Sopenharmony_ci * respect to standard time when the daylight savings rules are in 6957777dab0Sopenharmony_ci * effect. This is always a non-negative number, most commonly either 6967777dab0Sopenharmony_ci * 3,600,000 (one hour) or zero. 6977777dab0Sopenharmony_ci * 6987777dab0Sopenharmony_ci * @stable ICU 2.6 6997777dab0Sopenharmony_ci */ 7007777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 7017777dab0Sopenharmony_ciucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec); 7027777dab0Sopenharmony_ci 7037777dab0Sopenharmony_ci/** 7047777dab0Sopenharmony_ci * Get the current date and time. 7057777dab0Sopenharmony_ci * The value returned is represented as milliseconds from the epoch. 7067777dab0Sopenharmony_ci * @return The current date and time. 7077777dab0Sopenharmony_ci * @stable ICU 2.0 7087777dab0Sopenharmony_ci */ 7097777dab0Sopenharmony_ciU_CAPI UDate U_EXPORT2 7107777dab0Sopenharmony_ciucal_getNow(void); 7117777dab0Sopenharmony_ci 7127777dab0Sopenharmony_ci/** 7137777dab0Sopenharmony_ci * Open a UCalendar. 7147777dab0Sopenharmony_ci * A UCalendar may be used to convert a millisecond value to a year, 7157777dab0Sopenharmony_ci * month, and day. 7167777dab0Sopenharmony_ci * <p> 7177777dab0Sopenharmony_ci * Note: When unknown TimeZone ID is specified or if the TimeZone ID specified is "Etc/Unknown", 7187777dab0Sopenharmony_ci * the UCalendar returned by the function is initialized with GMT zone with TimeZone ID 7197777dab0Sopenharmony_ci * <code>UCAL_UNKNOWN_ZONE_ID</code> ("Etc/Unknown") without any errors/warnings. If you want 7207777dab0Sopenharmony_ci * to check if a TimeZone ID is valid prior to this function, use <code>ucal_getCanonicalTimeZoneID</code>. 7217777dab0Sopenharmony_ci * 7227777dab0Sopenharmony_ci * @param zoneID The desired TimeZone ID. If 0, use the default time zone. 7237777dab0Sopenharmony_ci * @param len The length of zoneID, or -1 if null-terminated. 7247777dab0Sopenharmony_ci * @param locale The desired locale 7257777dab0Sopenharmony_ci * @param type The type of UCalendar to open. This can be UCAL_GREGORIAN to open the Gregorian 7267777dab0Sopenharmony_ci * calendar for the locale, or UCAL_DEFAULT to open the default calendar for the locale (the 7277777dab0Sopenharmony_ci * default calendar may also be Gregorian). To open a specific non-Gregorian calendar for the 7287777dab0Sopenharmony_ci * locale, use uloc_setKeywordValue to set the value of the calendar keyword for the locale 7297777dab0Sopenharmony_ci * and then pass the locale to ucal_open with UCAL_DEFAULT as the type. 7307777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors 7317777dab0Sopenharmony_ci * @return A pointer to a UCalendar, or 0 if an error occurred. 7327777dab0Sopenharmony_ci * @see #UCAL_UNKNOWN_ZONE_ID 7337777dab0Sopenharmony_ci * @stable ICU 2.0 7347777dab0Sopenharmony_ci */ 7357777dab0Sopenharmony_ciU_CAPI UCalendar* U_EXPORT2 7367777dab0Sopenharmony_ciucal_open(const UChar* zoneID, 7377777dab0Sopenharmony_ci int32_t len, 7387777dab0Sopenharmony_ci const char* locale, 7397777dab0Sopenharmony_ci UCalendarType type, 7407777dab0Sopenharmony_ci UErrorCode* status); 7417777dab0Sopenharmony_ci 7427777dab0Sopenharmony_ci/** 7437777dab0Sopenharmony_ci * Close a UCalendar. 7447777dab0Sopenharmony_ci * Once closed, a UCalendar may no longer be used. 7457777dab0Sopenharmony_ci * @param cal The UCalendar to close. 7467777dab0Sopenharmony_ci * @stable ICU 2.0 7477777dab0Sopenharmony_ci */ 7487777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 7497777dab0Sopenharmony_ciucal_close(UCalendar *cal); 7507777dab0Sopenharmony_ci 7517777dab0Sopenharmony_ci/** 7527777dab0Sopenharmony_ci * Open a copy of a UCalendar. 7537777dab0Sopenharmony_ci * This function performs a deep copy. 7547777dab0Sopenharmony_ci * @param cal The calendar to copy 7557777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors. 7567777dab0Sopenharmony_ci * @return A pointer to a UCalendar identical to cal. 7577777dab0Sopenharmony_ci * @stable ICU 4.0 7587777dab0Sopenharmony_ci */ 7597777dab0Sopenharmony_ciU_CAPI UCalendar* U_EXPORT2 7607777dab0Sopenharmony_ciucal_clone(const UCalendar* cal, 7617777dab0Sopenharmony_ci UErrorCode* status); 7627777dab0Sopenharmony_ci 7637777dab0Sopenharmony_ci/** 7647777dab0Sopenharmony_ci * Set the TimeZone used by a UCalendar. 7657777dab0Sopenharmony_ci * A UCalendar uses a timezone for converting from Greenwich time to local time. 7667777dab0Sopenharmony_ci * @param cal The UCalendar to set. 7677777dab0Sopenharmony_ci * @param zoneID The desired TimeZone ID. If 0, use the default time zone. 7687777dab0Sopenharmony_ci * @param len The length of zoneID, or -1 if null-terminated. 7697777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors. 7707777dab0Sopenharmony_ci * @stable ICU 2.0 7717777dab0Sopenharmony_ci */ 7727777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 7737777dab0Sopenharmony_ciucal_setTimeZone(UCalendar* cal, 7747777dab0Sopenharmony_ci const UChar* zoneID, 7757777dab0Sopenharmony_ci int32_t len, 7767777dab0Sopenharmony_ci UErrorCode* status); 7777777dab0Sopenharmony_ci 7787777dab0Sopenharmony_ci/** 7797777dab0Sopenharmony_ci * Get the ID of the UCalendar's time zone. 7807777dab0Sopenharmony_ci * 7817777dab0Sopenharmony_ci * @param cal The UCalendar to query. 7827777dab0Sopenharmony_ci * @param result Receives the UCalendar's time zone ID. 7837777dab0Sopenharmony_ci * @param resultLength The maximum size of result. 7847777dab0Sopenharmony_ci * @param status Receives the status. 7857777dab0Sopenharmony_ci * @return The total buffer size needed; if greater than resultLength, the output was truncated. 7867777dab0Sopenharmony_ci * @stable ICU 51 7877777dab0Sopenharmony_ci */ 7887777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 7897777dab0Sopenharmony_ciucal_getTimeZoneID(const UCalendar *cal, 7907777dab0Sopenharmony_ci UChar *result, 7917777dab0Sopenharmony_ci int32_t resultLength, 7927777dab0Sopenharmony_ci UErrorCode *status); 7937777dab0Sopenharmony_ci 7947777dab0Sopenharmony_ci/** 7957777dab0Sopenharmony_ci * Possible formats for a UCalendar's display name 7967777dab0Sopenharmony_ci * @stable ICU 2.0 7977777dab0Sopenharmony_ci */ 7987777dab0Sopenharmony_cienum UCalendarDisplayNameType { 7997777dab0Sopenharmony_ci /** Standard display name */ 8007777dab0Sopenharmony_ci UCAL_STANDARD, 8017777dab0Sopenharmony_ci /** Short standard display name */ 8027777dab0Sopenharmony_ci UCAL_SHORT_STANDARD, 8037777dab0Sopenharmony_ci /** Daylight savings display name */ 8047777dab0Sopenharmony_ci UCAL_DST, 8057777dab0Sopenharmony_ci /** Short daylight savings display name */ 8067777dab0Sopenharmony_ci UCAL_SHORT_DST 8077777dab0Sopenharmony_ci}; 8087777dab0Sopenharmony_ci 8097777dab0Sopenharmony_ci/** @stable ICU 2.0 */ 8107777dab0Sopenharmony_citypedef enum UCalendarDisplayNameType UCalendarDisplayNameType; 8117777dab0Sopenharmony_ci 8127777dab0Sopenharmony_ci/** 8137777dab0Sopenharmony_ci * Get the display name for a UCalendar's TimeZone. 8147777dab0Sopenharmony_ci * A display name is suitable for presentation to a user. 8157777dab0Sopenharmony_ci * @param cal The UCalendar to query. 8167777dab0Sopenharmony_ci * @param type The desired display name format; one of UCAL_STANDARD, UCAL_SHORT_STANDARD, 8177777dab0Sopenharmony_ci * UCAL_DST, UCAL_SHORT_DST 8187777dab0Sopenharmony_ci * @param locale The desired locale for the display name. 8197777dab0Sopenharmony_ci * @param result A pointer to a buffer to receive the formatted number. 8207777dab0Sopenharmony_ci * @param resultLength The maximum size of result. 8217777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors 8227777dab0Sopenharmony_ci * @return The total buffer size needed; if greater than resultLength, the output was truncated. 8237777dab0Sopenharmony_ci * @stable ICU 2.0 8247777dab0Sopenharmony_ci */ 8257777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 8267777dab0Sopenharmony_ciucal_getTimeZoneDisplayName(const UCalendar* cal, 8277777dab0Sopenharmony_ci UCalendarDisplayNameType type, 8287777dab0Sopenharmony_ci const char* locale, 8297777dab0Sopenharmony_ci UChar* result, 8307777dab0Sopenharmony_ci int32_t resultLength, 8317777dab0Sopenharmony_ci UErrorCode* status); 8327777dab0Sopenharmony_ci 8337777dab0Sopenharmony_ci/** 8347777dab0Sopenharmony_ci * Determine if a UCalendar is currently in daylight savings time. 8357777dab0Sopenharmony_ci * Daylight savings time is not used in all parts of the world. 8367777dab0Sopenharmony_ci * @param cal The UCalendar to query. 8377777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors 8387777dab0Sopenharmony_ci * @return true if cal is currently in daylight savings time, false otherwise 8397777dab0Sopenharmony_ci * @stable ICU 2.0 8407777dab0Sopenharmony_ci */ 8417777dab0Sopenharmony_ciU_CAPI UBool U_EXPORT2 8427777dab0Sopenharmony_ciucal_inDaylightTime(const UCalendar* cal, 8437777dab0Sopenharmony_ci UErrorCode* status ); 8447777dab0Sopenharmony_ci 8457777dab0Sopenharmony_ci/** 8467777dab0Sopenharmony_ci * Sets the GregorianCalendar change date. This is the point when the switch from 8477777dab0Sopenharmony_ci * Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October 8487777dab0Sopenharmony_ci * 15, 1582. Previous to this time and date will be Julian dates. 8497777dab0Sopenharmony_ci * 8507777dab0Sopenharmony_ci * This function works only for Gregorian calendars. If the UCalendar is not 8517777dab0Sopenharmony_ci * an instance of a Gregorian calendar, then a U_UNSUPPORTED_ERROR 8527777dab0Sopenharmony_ci * error code is set. 8537777dab0Sopenharmony_ci * 8547777dab0Sopenharmony_ci * @param cal The calendar object. 8557777dab0Sopenharmony_ci * @param date The given Gregorian cutover date. 8567777dab0Sopenharmony_ci * @param pErrorCode Pointer to a standard ICU error code. Its input value must 8577777dab0Sopenharmony_ci * pass the U_SUCCESS() test, or else the function returns 8587777dab0Sopenharmony_ci * immediately. Check for U_FAILURE() on output or use with 8597777dab0Sopenharmony_ci * function chaining. (See User Guide for details.) 8607777dab0Sopenharmony_ci * 8617777dab0Sopenharmony_ci * @see GregorianCalendar::setGregorianChange 8627777dab0Sopenharmony_ci * @see ucal_getGregorianChange 8637777dab0Sopenharmony_ci * @stable ICU 3.6 8647777dab0Sopenharmony_ci */ 8657777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 8667777dab0Sopenharmony_ciucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode); 8677777dab0Sopenharmony_ci 8687777dab0Sopenharmony_ci/** 8697777dab0Sopenharmony_ci * Gets the Gregorian Calendar change date. This is the point when the switch from 8707777dab0Sopenharmony_ci * Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October 8717777dab0Sopenharmony_ci * 15, 1582. Previous to this time and date will be Julian dates. 8727777dab0Sopenharmony_ci * 8737777dab0Sopenharmony_ci * This function works only for Gregorian calendars. If the UCalendar is not 8747777dab0Sopenharmony_ci * an instance of a Gregorian calendar, then a U_UNSUPPORTED_ERROR 8757777dab0Sopenharmony_ci * error code is set. 8767777dab0Sopenharmony_ci * 8777777dab0Sopenharmony_ci * @param cal The calendar object. 8787777dab0Sopenharmony_ci * @param pErrorCode Pointer to a standard ICU error code. Its input value must 8797777dab0Sopenharmony_ci * pass the U_SUCCESS() test, or else the function returns 8807777dab0Sopenharmony_ci * immediately. Check for U_FAILURE() on output or use with 8817777dab0Sopenharmony_ci * function chaining. (See User Guide for details.) 8827777dab0Sopenharmony_ci * @return The Gregorian cutover time for this calendar. 8837777dab0Sopenharmony_ci * 8847777dab0Sopenharmony_ci * @see GregorianCalendar::getGregorianChange 8857777dab0Sopenharmony_ci * @see ucal_setGregorianChange 8867777dab0Sopenharmony_ci * @stable ICU 3.6 8877777dab0Sopenharmony_ci */ 8887777dab0Sopenharmony_ciU_CAPI UDate U_EXPORT2 8897777dab0Sopenharmony_ciucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode); 8907777dab0Sopenharmony_ci 8917777dab0Sopenharmony_ci/** 8927777dab0Sopenharmony_ci * Types of UCalendar attributes 8937777dab0Sopenharmony_ci * @stable ICU 2.0 8947777dab0Sopenharmony_ci */ 8957777dab0Sopenharmony_cienum UCalendarAttribute { 8967777dab0Sopenharmony_ci /** 8977777dab0Sopenharmony_ci * Lenient parsing 8987777dab0Sopenharmony_ci * @stable ICU 2.0 8997777dab0Sopenharmony_ci */ 9007777dab0Sopenharmony_ci UCAL_LENIENT, 9017777dab0Sopenharmony_ci /** 9027777dab0Sopenharmony_ci * First day of week 9037777dab0Sopenharmony_ci * @stable ICU 2.0 9047777dab0Sopenharmony_ci */ 9057777dab0Sopenharmony_ci UCAL_FIRST_DAY_OF_WEEK, 9067777dab0Sopenharmony_ci /** 9077777dab0Sopenharmony_ci * Minimum number of days in first week 9087777dab0Sopenharmony_ci * @stable ICU 2.0 9097777dab0Sopenharmony_ci */ 9107777dab0Sopenharmony_ci UCAL_MINIMAL_DAYS_IN_FIRST_WEEK, 9117777dab0Sopenharmony_ci /** 9127777dab0Sopenharmony_ci * The behavior for handling wall time repeating multiple times 9137777dab0Sopenharmony_ci * at negative time zone offset transitions 9147777dab0Sopenharmony_ci * @stable ICU 49 9157777dab0Sopenharmony_ci */ 9167777dab0Sopenharmony_ci UCAL_REPEATED_WALL_TIME, 9177777dab0Sopenharmony_ci /** 9187777dab0Sopenharmony_ci * The behavior for handling skipped wall time at positive time 9197777dab0Sopenharmony_ci * zone offset transitions. 9207777dab0Sopenharmony_ci * @stable ICU 49 9217777dab0Sopenharmony_ci */ 9227777dab0Sopenharmony_ci UCAL_SKIPPED_WALL_TIME 9237777dab0Sopenharmony_ci}; 9247777dab0Sopenharmony_ci 9257777dab0Sopenharmony_ci/** @stable ICU 2.0 */ 9267777dab0Sopenharmony_citypedef enum UCalendarAttribute UCalendarAttribute; 9277777dab0Sopenharmony_ci 9287777dab0Sopenharmony_ci/** 9297777dab0Sopenharmony_ci * Options for handling ambiguous wall time at time zone 9307777dab0Sopenharmony_ci * offset transitions. 9317777dab0Sopenharmony_ci * @stable ICU 49 9327777dab0Sopenharmony_ci */ 9337777dab0Sopenharmony_cienum UCalendarWallTimeOption { 9347777dab0Sopenharmony_ci /** 9357777dab0Sopenharmony_ci * An ambiguous wall time to be interpreted as the latest. 9367777dab0Sopenharmony_ci * This option is valid for UCAL_REPEATED_WALL_TIME and 9377777dab0Sopenharmony_ci * UCAL_SKIPPED_WALL_TIME. 9387777dab0Sopenharmony_ci * @stable ICU 49 9397777dab0Sopenharmony_ci */ 9407777dab0Sopenharmony_ci UCAL_WALLTIME_LAST, 9417777dab0Sopenharmony_ci /** 9427777dab0Sopenharmony_ci * An ambiguous wall time to be interpreted as the earliest. 9437777dab0Sopenharmony_ci * This option is valid for UCAL_REPEATED_WALL_TIME and 9447777dab0Sopenharmony_ci * UCAL_SKIPPED_WALL_TIME. 9457777dab0Sopenharmony_ci * @stable ICU 49 9467777dab0Sopenharmony_ci */ 9477777dab0Sopenharmony_ci UCAL_WALLTIME_FIRST, 9487777dab0Sopenharmony_ci /** 9497777dab0Sopenharmony_ci * An ambiguous wall time to be interpreted as the next valid 9507777dab0Sopenharmony_ci * wall time. This option is valid for UCAL_SKIPPED_WALL_TIME. 9517777dab0Sopenharmony_ci * @stable ICU 49 9527777dab0Sopenharmony_ci */ 9537777dab0Sopenharmony_ci UCAL_WALLTIME_NEXT_VALID 9547777dab0Sopenharmony_ci}; 9557777dab0Sopenharmony_ci/** @stable ICU 49 */ 9567777dab0Sopenharmony_citypedef enum UCalendarWallTimeOption UCalendarWallTimeOption; 9577777dab0Sopenharmony_ci 9587777dab0Sopenharmony_ci/** 9597777dab0Sopenharmony_ci * Get a numeric attribute associated with a UCalendar. 9607777dab0Sopenharmony_ci * Numeric attributes include the first day of the week, or the minimal numbers 9617777dab0Sopenharmony_ci * of days in the first week of the month. 9627777dab0Sopenharmony_ci * @param cal The UCalendar to query. 9637777dab0Sopenharmony_ci * @param attr The desired attribute; one of UCAL_LENIENT, UCAL_FIRST_DAY_OF_WEEK, 9647777dab0Sopenharmony_ci * UCAL_MINIMAL_DAYS_IN_FIRST_WEEK, UCAL_REPEATED_WALL_TIME or UCAL_SKIPPED_WALL_TIME 9657777dab0Sopenharmony_ci * @return The value of attr. 9667777dab0Sopenharmony_ci * @see ucal_setAttribute 9677777dab0Sopenharmony_ci * @stable ICU 2.0 9687777dab0Sopenharmony_ci */ 9697777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 9707777dab0Sopenharmony_ciucal_getAttribute(const UCalendar* cal, 9717777dab0Sopenharmony_ci UCalendarAttribute attr); 9727777dab0Sopenharmony_ci 9737777dab0Sopenharmony_ci/** 9747777dab0Sopenharmony_ci * Set a numeric attribute associated with a UCalendar. 9757777dab0Sopenharmony_ci * Numeric attributes include the first day of the week, or the minimal numbers 9767777dab0Sopenharmony_ci * of days in the first week of the month. 9777777dab0Sopenharmony_ci * @param cal The UCalendar to set. 9787777dab0Sopenharmony_ci * @param attr The desired attribute; one of UCAL_LENIENT, UCAL_FIRST_DAY_OF_WEEK, 9797777dab0Sopenharmony_ci * UCAL_MINIMAL_DAYS_IN_FIRST_WEEK, UCAL_REPEATED_WALL_TIME or UCAL_SKIPPED_WALL_TIME 9807777dab0Sopenharmony_ci * @param newValue The new value of attr. 9817777dab0Sopenharmony_ci * @see ucal_getAttribute 9827777dab0Sopenharmony_ci * @stable ICU 2.0 9837777dab0Sopenharmony_ci */ 9847777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 9857777dab0Sopenharmony_ciucal_setAttribute(UCalendar* cal, 9867777dab0Sopenharmony_ci UCalendarAttribute attr, 9877777dab0Sopenharmony_ci int32_t newValue); 9887777dab0Sopenharmony_ci 9897777dab0Sopenharmony_ci/** 9907777dab0Sopenharmony_ci * Get a locale for which calendars are available. 9917777dab0Sopenharmony_ci * A UCalendar in a locale returned by this function will contain the correct 9927777dab0Sopenharmony_ci * day and month names for the locale. 9937777dab0Sopenharmony_ci * @param localeIndex The index of the desired locale. 9947777dab0Sopenharmony_ci * @return A locale for which calendars are available, or 0 if none. 9957777dab0Sopenharmony_ci * @see ucal_countAvailable 9967777dab0Sopenharmony_ci * @stable ICU 2.0 9977777dab0Sopenharmony_ci */ 9987777dab0Sopenharmony_ciU_CAPI const char* U_EXPORT2 9997777dab0Sopenharmony_ciucal_getAvailable(int32_t localeIndex); 10007777dab0Sopenharmony_ci 10017777dab0Sopenharmony_ci/** 10027777dab0Sopenharmony_ci * Determine how many locales have calendars available. 10037777dab0Sopenharmony_ci * This function is most useful as determining the loop ending condition for 10047777dab0Sopenharmony_ci * calls to \ref ucal_getAvailable. 10057777dab0Sopenharmony_ci * @return The number of locales for which calendars are available. 10067777dab0Sopenharmony_ci * @see ucal_getAvailable 10077777dab0Sopenharmony_ci * @stable ICU 2.0 10087777dab0Sopenharmony_ci */ 10097777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 10107777dab0Sopenharmony_ciucal_countAvailable(void); 10117777dab0Sopenharmony_ci 10127777dab0Sopenharmony_ci/** 10137777dab0Sopenharmony_ci * Get a UCalendar's current time in millis. 10147777dab0Sopenharmony_ci * The time is represented as milliseconds from the epoch. 10157777dab0Sopenharmony_ci * @param cal The UCalendar to query. 10167777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors 10177777dab0Sopenharmony_ci * @return The calendar's current time in millis. 10187777dab0Sopenharmony_ci * @see ucal_setMillis 10197777dab0Sopenharmony_ci * @see ucal_setDate 10207777dab0Sopenharmony_ci * @see ucal_setDateTime 10217777dab0Sopenharmony_ci * @stable ICU 2.0 10227777dab0Sopenharmony_ci */ 10237777dab0Sopenharmony_ciU_CAPI UDate U_EXPORT2 10247777dab0Sopenharmony_ciucal_getMillis(const UCalendar* cal, 10257777dab0Sopenharmony_ci UErrorCode* status); 10267777dab0Sopenharmony_ci 10277777dab0Sopenharmony_ci/** 10287777dab0Sopenharmony_ci * Set a UCalendar's current time in millis. 10297777dab0Sopenharmony_ci * The time is represented as milliseconds from the epoch. 10307777dab0Sopenharmony_ci * @param cal The UCalendar to set. 10317777dab0Sopenharmony_ci * @param dateTime The desired date and time. 10327777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors 10337777dab0Sopenharmony_ci * @see ucal_getMillis 10347777dab0Sopenharmony_ci * @see ucal_setDate 10357777dab0Sopenharmony_ci * @see ucal_setDateTime 10367777dab0Sopenharmony_ci * @stable ICU 2.0 10377777dab0Sopenharmony_ci */ 10387777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 10397777dab0Sopenharmony_ciucal_setMillis(UCalendar* cal, 10407777dab0Sopenharmony_ci UDate dateTime, 10417777dab0Sopenharmony_ci UErrorCode* status ); 10427777dab0Sopenharmony_ci 10437777dab0Sopenharmony_ci/** 10447777dab0Sopenharmony_ci * Set a UCalendar's current date. 10457777dab0Sopenharmony_ci * The date is represented as a series of 32-bit integers. 10467777dab0Sopenharmony_ci * @param cal The UCalendar to set. 10477777dab0Sopenharmony_ci * @param year The desired year. 10487777dab0Sopenharmony_ci * @param month The desired month; one of UCAL_JANUARY, UCAL_FEBRUARY, UCAL_MARCH, UCAL_APRIL, UCAL_MAY, 10497777dab0Sopenharmony_ci * UCAL_JUNE, UCAL_JULY, UCAL_AUGUST, UCAL_SEPTEMBER, UCAL_OCTOBER, UCAL_NOVEMBER, UCAL_DECEMBER, UCAL_UNDECIMBER 10507777dab0Sopenharmony_ci * @param date The desired day of the month. 10517777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors 10527777dab0Sopenharmony_ci * @see ucal_getMillis 10537777dab0Sopenharmony_ci * @see ucal_setMillis 10547777dab0Sopenharmony_ci * @see ucal_setDateTime 10557777dab0Sopenharmony_ci * @stable ICU 2.0 10567777dab0Sopenharmony_ci */ 10577777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 10587777dab0Sopenharmony_ciucal_setDate(UCalendar* cal, 10597777dab0Sopenharmony_ci int32_t year, 10607777dab0Sopenharmony_ci int32_t month, 10617777dab0Sopenharmony_ci int32_t date, 10627777dab0Sopenharmony_ci UErrorCode* status); 10637777dab0Sopenharmony_ci 10647777dab0Sopenharmony_ci/** 10657777dab0Sopenharmony_ci * Set a UCalendar's current date. 10667777dab0Sopenharmony_ci * The date is represented as a series of 32-bit integers. 10677777dab0Sopenharmony_ci * @param cal The UCalendar to set. 10687777dab0Sopenharmony_ci * @param year The desired year. 10697777dab0Sopenharmony_ci * @param month The desired month; one of UCAL_JANUARY, UCAL_FEBRUARY, UCAL_MARCH, UCAL_APRIL, UCAL_MAY, 10707777dab0Sopenharmony_ci * UCAL_JUNE, UCAL_JULY, UCAL_AUGUST, UCAL_SEPTEMBER, UCAL_OCTOBER, UCAL_NOVEMBER, UCAL_DECEMBER, UCAL_UNDECIMBER 10717777dab0Sopenharmony_ci * @param date The desired day of the month. 10727777dab0Sopenharmony_ci * @param hour The desired hour of day. 10737777dab0Sopenharmony_ci * @param minute The desired minute. 10747777dab0Sopenharmony_ci * @param second The desirec second. 10757777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors 10767777dab0Sopenharmony_ci * @see ucal_getMillis 10777777dab0Sopenharmony_ci * @see ucal_setMillis 10787777dab0Sopenharmony_ci * @see ucal_setDate 10797777dab0Sopenharmony_ci * @stable ICU 2.0 10807777dab0Sopenharmony_ci */ 10817777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 10827777dab0Sopenharmony_ciucal_setDateTime(UCalendar* cal, 10837777dab0Sopenharmony_ci int32_t year, 10847777dab0Sopenharmony_ci int32_t month, 10857777dab0Sopenharmony_ci int32_t date, 10867777dab0Sopenharmony_ci int32_t hour, 10877777dab0Sopenharmony_ci int32_t minute, 10887777dab0Sopenharmony_ci int32_t second, 10897777dab0Sopenharmony_ci UErrorCode* status); 10907777dab0Sopenharmony_ci 10917777dab0Sopenharmony_ci/** 10927777dab0Sopenharmony_ci * Returns true if two UCalendars are equivalent. Equivalent 10937777dab0Sopenharmony_ci * UCalendars will behave identically, but they may be set to 10947777dab0Sopenharmony_ci * different times. 10957777dab0Sopenharmony_ci * @param cal1 The first of the UCalendars to compare. 10967777dab0Sopenharmony_ci * @param cal2 The second of the UCalendars to compare. 10977777dab0Sopenharmony_ci * @return true if cal1 and cal2 are equivalent, false otherwise. 10987777dab0Sopenharmony_ci * @stable ICU 2.0 10997777dab0Sopenharmony_ci */ 11007777dab0Sopenharmony_ciU_CAPI UBool U_EXPORT2 11017777dab0Sopenharmony_ciucal_equivalentTo(const UCalendar* cal1, 11027777dab0Sopenharmony_ci const UCalendar* cal2); 11037777dab0Sopenharmony_ci 11047777dab0Sopenharmony_ci/** 11057777dab0Sopenharmony_ci * Add a specified signed amount to a particular field in a UCalendar. 11067777dab0Sopenharmony_ci * This can modify more significant fields in the calendar. 11077777dab0Sopenharmony_ci * Adding a positive value always means moving forward in time, so for the Gregorian calendar, 11087777dab0Sopenharmony_ci * starting with 100 BC and adding +1 to year results in 99 BC (even though this actually reduces 11097777dab0Sopenharmony_ci * the numeric value of the field itself). 11107777dab0Sopenharmony_ci * @param cal The UCalendar to which to add. 11117777dab0Sopenharmony_ci * @param field The field to which to add the signed value; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, 11127777dab0Sopenharmony_ci * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, 11137777dab0Sopenharmony_ci * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, 11147777dab0Sopenharmony_ci * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. 11157777dab0Sopenharmony_ci * @param amount The signed amount to add to field. If the amount causes the value 11167777dab0Sopenharmony_ci * to exceed to maximum or minimum values for that field, other fields are modified 11177777dab0Sopenharmony_ci * to preserve the magnitude of the change. 11187777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors 11197777dab0Sopenharmony_ci * @see ucal_roll 11207777dab0Sopenharmony_ci * @stable ICU 2.0 11217777dab0Sopenharmony_ci */ 11227777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 11237777dab0Sopenharmony_ciucal_add(UCalendar* cal, 11247777dab0Sopenharmony_ci UCalendarDateFields field, 11257777dab0Sopenharmony_ci int32_t amount, 11267777dab0Sopenharmony_ci UErrorCode* status); 11277777dab0Sopenharmony_ci 11287777dab0Sopenharmony_ci/** 11297777dab0Sopenharmony_ci * Add a specified signed amount to a particular field in a UCalendar. 11307777dab0Sopenharmony_ci * This will not modify more significant fields in the calendar. 11317777dab0Sopenharmony_ci * Rolling by a positive value always means moving forward in time (unless the limit of the 11327777dab0Sopenharmony_ci * field is reached, in which case it may pin or wrap), so for Gregorian calendar, 11337777dab0Sopenharmony_ci * starting with 100 BC and rolling the year by +1 results in 99 BC. 11347777dab0Sopenharmony_ci * When eras have a definite beginning and end (as in the Chinese calendar, or as in most eras in the 11357777dab0Sopenharmony_ci * Japanese calendar) then rolling the year past either limit of the era will cause the year to wrap around. 11367777dab0Sopenharmony_ci * When eras only have a limit at one end, then attempting to roll the year past that limit will result in 11377777dab0Sopenharmony_ci * pinning the year at that limit. Note that for most calendars in which era 0 years move forward in time 11387777dab0Sopenharmony_ci * (such as Buddhist, Hebrew, or Islamic), it is possible for add or roll to result in negative years for 11397777dab0Sopenharmony_ci * era 0 (that is the only way to represent years before the calendar epoch). 11407777dab0Sopenharmony_ci * @param cal The UCalendar to which to add. 11417777dab0Sopenharmony_ci * @param field The field to which to add the signed value; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, 11427777dab0Sopenharmony_ci * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, 11437777dab0Sopenharmony_ci * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, 11447777dab0Sopenharmony_ci * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. 11457777dab0Sopenharmony_ci * @param amount The signed amount to add to field. If the amount causes the value 11467777dab0Sopenharmony_ci * to exceed to maximum or minimum values for that field, the field is pinned to a permissible 11477777dab0Sopenharmony_ci * value. 11487777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors 11497777dab0Sopenharmony_ci * @see ucal_add 11507777dab0Sopenharmony_ci * @stable ICU 2.0 11517777dab0Sopenharmony_ci */ 11527777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 11537777dab0Sopenharmony_ciucal_roll(UCalendar* cal, 11547777dab0Sopenharmony_ci UCalendarDateFields field, 11557777dab0Sopenharmony_ci int32_t amount, 11567777dab0Sopenharmony_ci UErrorCode* status); 11577777dab0Sopenharmony_ci 11587777dab0Sopenharmony_ci/** 11597777dab0Sopenharmony_ci * Get the current value of a field from a UCalendar. 11607777dab0Sopenharmony_ci * All fields are represented as 32-bit integers. 11617777dab0Sopenharmony_ci * @param cal The UCalendar to query. 11627777dab0Sopenharmony_ci * @param field The desired field; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, 11637777dab0Sopenharmony_ci * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, 11647777dab0Sopenharmony_ci * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, 11657777dab0Sopenharmony_ci * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. 11667777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors 11677777dab0Sopenharmony_ci * @return The value of the desired field. 11687777dab0Sopenharmony_ci * @see ucal_set 11697777dab0Sopenharmony_ci * @see ucal_isSet 11707777dab0Sopenharmony_ci * @see ucal_clearField 11717777dab0Sopenharmony_ci * @see ucal_clear 11727777dab0Sopenharmony_ci * @stable ICU 2.0 11737777dab0Sopenharmony_ci */ 11747777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 11757777dab0Sopenharmony_ciucal_get(const UCalendar* cal, 11767777dab0Sopenharmony_ci UCalendarDateFields field, 11777777dab0Sopenharmony_ci UErrorCode* status ); 11787777dab0Sopenharmony_ci 11797777dab0Sopenharmony_ci/** 11807777dab0Sopenharmony_ci * Set the value of a field in a UCalendar. 11817777dab0Sopenharmony_ci * All fields are represented as 32-bit integers. 11827777dab0Sopenharmony_ci * @param cal The UCalendar to set. 11837777dab0Sopenharmony_ci * @param field The field to set; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, 11847777dab0Sopenharmony_ci * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, 11857777dab0Sopenharmony_ci * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, 11867777dab0Sopenharmony_ci * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. 11877777dab0Sopenharmony_ci * @param value The desired value of field. 11887777dab0Sopenharmony_ci * @see ucal_get 11897777dab0Sopenharmony_ci * @see ucal_isSet 11907777dab0Sopenharmony_ci * @see ucal_clearField 11917777dab0Sopenharmony_ci * @see ucal_clear 11927777dab0Sopenharmony_ci * @stable ICU 2.0 11937777dab0Sopenharmony_ci */ 11947777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 11957777dab0Sopenharmony_ciucal_set(UCalendar* cal, 11967777dab0Sopenharmony_ci UCalendarDateFields field, 11977777dab0Sopenharmony_ci int32_t value); 11987777dab0Sopenharmony_ci 11997777dab0Sopenharmony_ci/** 12007777dab0Sopenharmony_ci * Determine if a field in a UCalendar is set. 12017777dab0Sopenharmony_ci * All fields are represented as 32-bit integers. 12027777dab0Sopenharmony_ci * @param cal The UCalendar to query. 12037777dab0Sopenharmony_ci * @param field The desired field; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, 12047777dab0Sopenharmony_ci * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, 12057777dab0Sopenharmony_ci * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, 12067777dab0Sopenharmony_ci * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. 12077777dab0Sopenharmony_ci * @return true if field is set, false otherwise. 12087777dab0Sopenharmony_ci * @see ucal_get 12097777dab0Sopenharmony_ci * @see ucal_set 12107777dab0Sopenharmony_ci * @see ucal_clearField 12117777dab0Sopenharmony_ci * @see ucal_clear 12127777dab0Sopenharmony_ci * @stable ICU 2.0 12137777dab0Sopenharmony_ci */ 12147777dab0Sopenharmony_ciU_CAPI UBool U_EXPORT2 12157777dab0Sopenharmony_ciucal_isSet(const UCalendar* cal, 12167777dab0Sopenharmony_ci UCalendarDateFields field); 12177777dab0Sopenharmony_ci 12187777dab0Sopenharmony_ci/** 12197777dab0Sopenharmony_ci * Clear a field in a UCalendar. 12207777dab0Sopenharmony_ci * All fields are represented as 32-bit integers. 12217777dab0Sopenharmony_ci * @param cal The UCalendar containing the field to clear. 12227777dab0Sopenharmony_ci * @param field The field to clear; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, 12237777dab0Sopenharmony_ci * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, 12247777dab0Sopenharmony_ci * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, 12257777dab0Sopenharmony_ci * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. 12267777dab0Sopenharmony_ci * @see ucal_get 12277777dab0Sopenharmony_ci * @see ucal_set 12287777dab0Sopenharmony_ci * @see ucal_isSet 12297777dab0Sopenharmony_ci * @see ucal_clear 12307777dab0Sopenharmony_ci * @stable ICU 2.0 12317777dab0Sopenharmony_ci */ 12327777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 12337777dab0Sopenharmony_ciucal_clearField(UCalendar* cal, 12347777dab0Sopenharmony_ci UCalendarDateFields field); 12357777dab0Sopenharmony_ci 12367777dab0Sopenharmony_ci/** 12377777dab0Sopenharmony_ci * Clear all fields in a UCalendar. 12387777dab0Sopenharmony_ci * All fields are represented as 32-bit integers. 12397777dab0Sopenharmony_ci * @param calendar The UCalendar to clear. 12407777dab0Sopenharmony_ci * @see ucal_get 12417777dab0Sopenharmony_ci * @see ucal_set 12427777dab0Sopenharmony_ci * @see ucal_isSet 12437777dab0Sopenharmony_ci * @see ucal_clearField 12447777dab0Sopenharmony_ci * @stable ICU 2.0 12457777dab0Sopenharmony_ci */ 12467777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 12477777dab0Sopenharmony_ciucal_clear(UCalendar* calendar); 12487777dab0Sopenharmony_ci 12497777dab0Sopenharmony_ci/** 12507777dab0Sopenharmony_ci * Possible limit values for a UCalendar 12517777dab0Sopenharmony_ci * @stable ICU 2.0 12527777dab0Sopenharmony_ci */ 12537777dab0Sopenharmony_cienum UCalendarLimitType { 12547777dab0Sopenharmony_ci /** Minimum value */ 12557777dab0Sopenharmony_ci UCAL_MINIMUM, 12567777dab0Sopenharmony_ci /** Maximum value */ 12577777dab0Sopenharmony_ci UCAL_MAXIMUM, 12587777dab0Sopenharmony_ci /** Greatest minimum value */ 12597777dab0Sopenharmony_ci UCAL_GREATEST_MINIMUM, 12607777dab0Sopenharmony_ci /** Least maximum value */ 12617777dab0Sopenharmony_ci UCAL_LEAST_MAXIMUM, 12627777dab0Sopenharmony_ci /** Actual minimum value */ 12637777dab0Sopenharmony_ci UCAL_ACTUAL_MINIMUM, 12647777dab0Sopenharmony_ci /** Actual maximum value */ 12657777dab0Sopenharmony_ci UCAL_ACTUAL_MAXIMUM 12667777dab0Sopenharmony_ci}; 12677777dab0Sopenharmony_ci 12687777dab0Sopenharmony_ci/** @stable ICU 2.0 */ 12697777dab0Sopenharmony_citypedef enum UCalendarLimitType UCalendarLimitType; 12707777dab0Sopenharmony_ci 12717777dab0Sopenharmony_ci/** 12727777dab0Sopenharmony_ci * Determine a limit for a field in a UCalendar. 12737777dab0Sopenharmony_ci * A limit is a maximum or minimum value for a field. 12747777dab0Sopenharmony_ci * @param cal The UCalendar to query. 12757777dab0Sopenharmony_ci * @param field The desired field; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, 12767777dab0Sopenharmony_ci * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, 12777777dab0Sopenharmony_ci * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, 12787777dab0Sopenharmony_ci * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. 12797777dab0Sopenharmony_ci * @param type The desired critical point; one of UCAL_MINIMUM, UCAL_MAXIMUM, UCAL_GREATEST_MINIMUM, 12807777dab0Sopenharmony_ci * UCAL_LEAST_MAXIMUM, UCAL_ACTUAL_MINIMUM, UCAL_ACTUAL_MAXIMUM 12817777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors. 12827777dab0Sopenharmony_ci * @return The requested value. 12837777dab0Sopenharmony_ci * @stable ICU 2.0 12847777dab0Sopenharmony_ci */ 12857777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 12867777dab0Sopenharmony_ciucal_getLimit(const UCalendar* cal, 12877777dab0Sopenharmony_ci UCalendarDateFields field, 12887777dab0Sopenharmony_ci UCalendarLimitType type, 12897777dab0Sopenharmony_ci UErrorCode* status); 12907777dab0Sopenharmony_ci 12917777dab0Sopenharmony_ci/** Get the locale for this calendar object. You can choose between valid and actual locale. 12927777dab0Sopenharmony_ci * @param cal The calendar object 12937777dab0Sopenharmony_ci * @param type type of the locale we're looking for (valid or actual) 12947777dab0Sopenharmony_ci * @param status error code for the operation 12957777dab0Sopenharmony_ci * @return the locale name 12967777dab0Sopenharmony_ci * @stable ICU 2.8 12977777dab0Sopenharmony_ci */ 12987777dab0Sopenharmony_ciU_CAPI const char * U_EXPORT2 12997777dab0Sopenharmony_ciucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status); 13007777dab0Sopenharmony_ci 13017777dab0Sopenharmony_ci/** 13027777dab0Sopenharmony_ci * Returns the timezone data version currently used by ICU. 13037777dab0Sopenharmony_ci * @param status error code for the operation 13047777dab0Sopenharmony_ci * @return the version string, such as "2007f" 13057777dab0Sopenharmony_ci * @stable ICU 3.8 13067777dab0Sopenharmony_ci */ 13077777dab0Sopenharmony_ciU_CAPI const char * U_EXPORT2 13087777dab0Sopenharmony_ciucal_getTZDataVersion(UErrorCode* status); 13097777dab0Sopenharmony_ci 13107777dab0Sopenharmony_ci/** 13117777dab0Sopenharmony_ci * Returns the canonical system timezone ID or the normalized 13127777dab0Sopenharmony_ci * custom time zone ID for the given time zone ID. 13137777dab0Sopenharmony_ci * @param id The input timezone ID to be canonicalized. 13147777dab0Sopenharmony_ci * @param len The length of id, or -1 if null-terminated. 13157777dab0Sopenharmony_ci * @param result The buffer receives the canonical system timezone ID 13167777dab0Sopenharmony_ci * or the custom timezone ID in normalized format. 13177777dab0Sopenharmony_ci * @param resultCapacity The capacity of the result buffer. 13187777dab0Sopenharmony_ci * @param isSystemID Receives if the given ID is a known system 13197777dab0Sopenharmony_ci * timezone ID. 13207777dab0Sopenharmony_ci * @param status Receives the status. When the given timezone ID 13217777dab0Sopenharmony_ci * is neither a known system time zone ID nor a 13227777dab0Sopenharmony_ci * valid custom timezone ID, U_ILLEGAL_ARGUMENT_ERROR 13237777dab0Sopenharmony_ci * is set. 13247777dab0Sopenharmony_ci * @return The result string length, not including the terminating 13257777dab0Sopenharmony_ci * null. 13267777dab0Sopenharmony_ci * @stable ICU 4.0 13277777dab0Sopenharmony_ci */ 13287777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 13297777dab0Sopenharmony_ciucal_getCanonicalTimeZoneID(const UChar* id, int32_t len, 13307777dab0Sopenharmony_ci UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status); 13317777dab0Sopenharmony_ci/** 13327777dab0Sopenharmony_ci * Get the resource keyword value string designating the calendar type for the UCalendar. 13337777dab0Sopenharmony_ci * @param cal The UCalendar to query. 13347777dab0Sopenharmony_ci * @param status The error code for the operation. 13357777dab0Sopenharmony_ci * @return The resource keyword value string. 13367777dab0Sopenharmony_ci * @stable ICU 4.2 13377777dab0Sopenharmony_ci */ 13387777dab0Sopenharmony_ciU_CAPI const char * U_EXPORT2 13397777dab0Sopenharmony_ciucal_getType(const UCalendar *cal, UErrorCode* status); 13407777dab0Sopenharmony_ci 13417777dab0Sopenharmony_ci/** 13427777dab0Sopenharmony_ci * Given a key and a locale, returns an array of string values in a preferred 13437777dab0Sopenharmony_ci * order that would make a difference. These are all and only those values where 13447777dab0Sopenharmony_ci * the open (creation) of the service with the locale formed from the input locale 13457777dab0Sopenharmony_ci * plus input keyword and that value has different behavior than creation with the 13467777dab0Sopenharmony_ci * input locale alone. 13477777dab0Sopenharmony_ci * @param key one of the keys supported by this service. For now, only 13487777dab0Sopenharmony_ci * "calendar" is supported. 13497777dab0Sopenharmony_ci * @param locale the locale 13507777dab0Sopenharmony_ci * @param commonlyUsed if set to true it will return only commonly used values 13517777dab0Sopenharmony_ci * with the given locale in preferred order. Otherwise, 13527777dab0Sopenharmony_ci * it will return all the available values for the locale. 13537777dab0Sopenharmony_ci * @param status error status 13547777dab0Sopenharmony_ci * @return a string enumeration over keyword values for the given key and the locale. 13557777dab0Sopenharmony_ci * @stable ICU 4.2 13567777dab0Sopenharmony_ci */ 13577777dab0Sopenharmony_ciU_CAPI UEnumeration* U_EXPORT2 13587777dab0Sopenharmony_ciucal_getKeywordValuesForLocale(const char* key, 13597777dab0Sopenharmony_ci const char* locale, 13607777dab0Sopenharmony_ci UBool commonlyUsed, 13617777dab0Sopenharmony_ci UErrorCode* status); 13627777dab0Sopenharmony_ci 13637777dab0Sopenharmony_ci 13647777dab0Sopenharmony_ci/** Weekday types, as returned by ucal_getDayOfWeekType(). 13657777dab0Sopenharmony_ci * @stable ICU 4.4 13667777dab0Sopenharmony_ci */ 13677777dab0Sopenharmony_cienum UCalendarWeekdayType { 13687777dab0Sopenharmony_ci /** 13697777dab0Sopenharmony_ci * Designates a full weekday (no part of the day is included in the weekend). 13707777dab0Sopenharmony_ci * @stable ICU 4.4 13717777dab0Sopenharmony_ci */ 13727777dab0Sopenharmony_ci UCAL_WEEKDAY, 13737777dab0Sopenharmony_ci /** 13747777dab0Sopenharmony_ci * Designates a full weekend day (the entire day is included in the weekend). 13757777dab0Sopenharmony_ci * @stable ICU 4.4 13767777dab0Sopenharmony_ci */ 13777777dab0Sopenharmony_ci UCAL_WEEKEND, 13787777dab0Sopenharmony_ci /** 13797777dab0Sopenharmony_ci * Designates a day that starts as a weekday and transitions to the weekend. 13807777dab0Sopenharmony_ci * Call ucal_getWeekendTransition() to get the time of transition. 13817777dab0Sopenharmony_ci * @stable ICU 4.4 13827777dab0Sopenharmony_ci */ 13837777dab0Sopenharmony_ci UCAL_WEEKEND_ONSET, 13847777dab0Sopenharmony_ci /** 13857777dab0Sopenharmony_ci * Designates a day that starts as the weekend and transitions to a weekday. 13867777dab0Sopenharmony_ci * Call ucal_getWeekendTransition() to get the time of transition. 13877777dab0Sopenharmony_ci * @stable ICU 4.4 13887777dab0Sopenharmony_ci */ 13897777dab0Sopenharmony_ci UCAL_WEEKEND_CEASE 13907777dab0Sopenharmony_ci}; 13917777dab0Sopenharmony_ci 13927777dab0Sopenharmony_ci/** @stable ICU 4.4 */ 13937777dab0Sopenharmony_citypedef enum UCalendarWeekdayType UCalendarWeekdayType; 13947777dab0Sopenharmony_ci 13957777dab0Sopenharmony_ci/** 13967777dab0Sopenharmony_ci * Returns whether the given day of the week is a weekday, a weekend day, 13977777dab0Sopenharmony_ci * or a day that transitions from one to the other, for the locale and 13987777dab0Sopenharmony_ci * calendar system associated with this UCalendar (the locale's region is 13997777dab0Sopenharmony_ci * often the most determinant factor). If a transition occurs at midnight, 14007777dab0Sopenharmony_ci * then the days before and after the transition will have the 14017777dab0Sopenharmony_ci * type UCAL_WEEKDAY or UCAL_WEEKEND. If a transition occurs at a time 14027777dab0Sopenharmony_ci * other than midnight, then the day of the transition will have 14037777dab0Sopenharmony_ci * the type UCAL_WEEKEND_ONSET or UCAL_WEEKEND_CEASE. In this case, the 14047777dab0Sopenharmony_ci * function ucal_getWeekendTransition() will return the point of 14057777dab0Sopenharmony_ci * transition. 14067777dab0Sopenharmony_ci * @param cal The UCalendar to query. 14077777dab0Sopenharmony_ci * @param dayOfWeek The day of the week whose type is desired (UCAL_SUNDAY..UCAL_SATURDAY). 14087777dab0Sopenharmony_ci * @param status The error code for the operation. 14097777dab0Sopenharmony_ci * @return The UCalendarWeekdayType for the day of the week. 14107777dab0Sopenharmony_ci * @stable ICU 4.4 14117777dab0Sopenharmony_ci */ 14127777dab0Sopenharmony_ciU_CAPI UCalendarWeekdayType U_EXPORT2 14137777dab0Sopenharmony_ciucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status); 14147777dab0Sopenharmony_ci 14157777dab0Sopenharmony_ci/** 14167777dab0Sopenharmony_ci * Returns the time during the day at which the weekend begins or ends in 14177777dab0Sopenharmony_ci * this calendar system. If ucal_getDayOfWeekType() returns UCAL_WEEKEND_ONSET 14187777dab0Sopenharmony_ci * for the specified dayOfWeek, return the time at which the weekend begins. 14197777dab0Sopenharmony_ci * If ucal_getDayOfWeekType() returns UCAL_WEEKEND_CEASE for the specified dayOfWeek, 14207777dab0Sopenharmony_ci * return the time at which the weekend ends. If ucal_getDayOfWeekType() returns 14217777dab0Sopenharmony_ci * some other UCalendarWeekdayType for the specified dayOfWeek, is it an error condition 14227777dab0Sopenharmony_ci * (U_ILLEGAL_ARGUMENT_ERROR). 14237777dab0Sopenharmony_ci * @param cal The UCalendar to query. 14247777dab0Sopenharmony_ci * @param dayOfWeek The day of the week for which the weekend transition time is 14257777dab0Sopenharmony_ci * desired (UCAL_SUNDAY..UCAL_SATURDAY). 14267777dab0Sopenharmony_ci * @param status The error code for the operation. 14277777dab0Sopenharmony_ci * @return The milliseconds after midnight at which the weekend begins or ends. 14287777dab0Sopenharmony_ci * @stable ICU 4.4 14297777dab0Sopenharmony_ci */ 14307777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 14317777dab0Sopenharmony_ciucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status); 14327777dab0Sopenharmony_ci 14337777dab0Sopenharmony_ci/** 14347777dab0Sopenharmony_ci * Returns true if the given UDate is in the weekend in 14357777dab0Sopenharmony_ci * this calendar system. 14367777dab0Sopenharmony_ci * @param cal The UCalendar to query. 14377777dab0Sopenharmony_ci * @param date The UDate in question. 14387777dab0Sopenharmony_ci * @param status The error code for the operation. 14397777dab0Sopenharmony_ci * @return true if the given UDate is in the weekend in 14407777dab0Sopenharmony_ci * this calendar system, false otherwise. 14417777dab0Sopenharmony_ci * @stable ICU 4.4 14427777dab0Sopenharmony_ci */ 14437777dab0Sopenharmony_ciU_CAPI UBool U_EXPORT2 14447777dab0Sopenharmony_ciucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status); 14457777dab0Sopenharmony_ci 14467777dab0Sopenharmony_ci/** 14477777dab0Sopenharmony_ci * Return the difference between the target time and the time this calendar object is currently set to. 14487777dab0Sopenharmony_ci * If the target time is after the current calendar setting, the the returned value will be positive. 14497777dab0Sopenharmony_ci * The field parameter specifies the units of the return value. For example, if field is UCAL_MONTH 14507777dab0Sopenharmony_ci * and ucal_getFieldDifference returns 3, then the target time is 3 to less than 4 months after the 14517777dab0Sopenharmony_ci * current calendar setting. 14527777dab0Sopenharmony_ci * 14537777dab0Sopenharmony_ci * As a side effect of this call, this calendar is advanced toward target by the given amount. That is, 14547777dab0Sopenharmony_ci * calling this function has the side effect of calling ucal_add on this calendar with the specified 14557777dab0Sopenharmony_ci * field and an amount equal to the return value from this function. 14567777dab0Sopenharmony_ci * 14577777dab0Sopenharmony_ci * A typical way of using this function is to call it first with the largest field of interest, then 14587777dab0Sopenharmony_ci * with progressively smaller fields. 14597777dab0Sopenharmony_ci * 14607777dab0Sopenharmony_ci * @param cal The UCalendar to compare and update. 14617777dab0Sopenharmony_ci * @param target The target date to compare to the current calendar setting. 14627777dab0Sopenharmony_ci * @param field The field to compare; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, 14637777dab0Sopenharmony_ci * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, 14647777dab0Sopenharmony_ci * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, 14657777dab0Sopenharmony_ci * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. 14667777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors 14677777dab0Sopenharmony_ci * @return The date difference for the specified field. 14687777dab0Sopenharmony_ci * @stable ICU 4.8 14697777dab0Sopenharmony_ci */ 14707777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 14717777dab0Sopenharmony_ciucal_getFieldDifference(UCalendar* cal, 14727777dab0Sopenharmony_ci UDate target, 14737777dab0Sopenharmony_ci UCalendarDateFields field, 14747777dab0Sopenharmony_ci UErrorCode* status); 14757777dab0Sopenharmony_ci 14767777dab0Sopenharmony_ci/** 14777777dab0Sopenharmony_ci * Time zone transition types for ucal_getTimeZoneTransitionDate 14787777dab0Sopenharmony_ci * @stable ICU 50 14797777dab0Sopenharmony_ci */ 14807777dab0Sopenharmony_cienum UTimeZoneTransitionType { 14817777dab0Sopenharmony_ci /** 14827777dab0Sopenharmony_ci * Get the next transition after the current date, 14837777dab0Sopenharmony_ci * i.e. excludes the current date 14847777dab0Sopenharmony_ci * @stable ICU 50 14857777dab0Sopenharmony_ci */ 14867777dab0Sopenharmony_ci UCAL_TZ_TRANSITION_NEXT, 14877777dab0Sopenharmony_ci /** 14887777dab0Sopenharmony_ci * Get the next transition on or after the current date, 14897777dab0Sopenharmony_ci * i.e. may include the current date 14907777dab0Sopenharmony_ci * @stable ICU 50 14917777dab0Sopenharmony_ci */ 14927777dab0Sopenharmony_ci UCAL_TZ_TRANSITION_NEXT_INCLUSIVE, 14937777dab0Sopenharmony_ci /** 14947777dab0Sopenharmony_ci * Get the previous transition before the current date, 14957777dab0Sopenharmony_ci * i.e. excludes the current date 14967777dab0Sopenharmony_ci * @stable ICU 50 14977777dab0Sopenharmony_ci */ 14987777dab0Sopenharmony_ci UCAL_TZ_TRANSITION_PREVIOUS, 14997777dab0Sopenharmony_ci /** 15007777dab0Sopenharmony_ci * Get the previous transition on or before the current date, 15017777dab0Sopenharmony_ci * i.e. may include the current date 15027777dab0Sopenharmony_ci * @stable ICU 50 15037777dab0Sopenharmony_ci */ 15047777dab0Sopenharmony_ci UCAL_TZ_TRANSITION_PREVIOUS_INCLUSIVE 15057777dab0Sopenharmony_ci}; 15067777dab0Sopenharmony_ci 15077777dab0Sopenharmony_citypedef enum UTimeZoneTransitionType UTimeZoneTransitionType; /**< @stable ICU 50 */ 15087777dab0Sopenharmony_ci 15097777dab0Sopenharmony_ci/** 15107777dab0Sopenharmony_ci* Get the UDate for the next/previous time zone transition relative to 15117777dab0Sopenharmony_ci* the calendar's current date, in the time zone to which the calendar 15127777dab0Sopenharmony_ci* is currently set. If there is no known time zone transition of the 15137777dab0Sopenharmony_ci* requested type relative to the calendar's date, the function returns 15147777dab0Sopenharmony_ci* false. 15157777dab0Sopenharmony_ci* @param cal The UCalendar to query. 15167777dab0Sopenharmony_ci* @param type The type of transition desired. 15177777dab0Sopenharmony_ci* @param transition A pointer to a UDate to be set to the transition time. 15187777dab0Sopenharmony_ci* If the function returns false, the value set is unspecified. 15197777dab0Sopenharmony_ci* @param status A pointer to a UErrorCode to receive any errors. 15207777dab0Sopenharmony_ci* @return true if a valid transition time is set in *transition, false 15217777dab0Sopenharmony_ci* otherwise. 15227777dab0Sopenharmony_ci* @stable ICU 50 15237777dab0Sopenharmony_ci*/ 15247777dab0Sopenharmony_ciU_CAPI UBool U_EXPORT2 15257777dab0Sopenharmony_ciucal_getTimeZoneTransitionDate(const UCalendar* cal, UTimeZoneTransitionType type, 15267777dab0Sopenharmony_ci UDate* transition, UErrorCode* status); 15277777dab0Sopenharmony_ci 15287777dab0Sopenharmony_ci/** 15297777dab0Sopenharmony_ci* Converts a system time zone ID to an equivalent Windows time zone ID. For example, 15307777dab0Sopenharmony_ci* Windows time zone ID "Pacific Standard Time" is returned for input "America/Los_Angeles". 15317777dab0Sopenharmony_ci* 15327777dab0Sopenharmony_ci* <p>There are system time zones that cannot be mapped to Windows zones. When the input 15337777dab0Sopenharmony_ci* system time zone ID is unknown or unmappable to a Windows time zone, then this 15347777dab0Sopenharmony_ci* function returns 0 as the result length, but the operation itself remains successful 15357777dab0Sopenharmony_ci* (no error status set on return). 15367777dab0Sopenharmony_ci* 15377777dab0Sopenharmony_ci* <p>This implementation utilizes <a href="http://unicode.org/cldr/charts/supplemental/zone_tzid.html"> 15387777dab0Sopenharmony_ci* Zone-Tzid mapping data</a>. The mapping data is updated time to time. To get the latest changes, 15397777dab0Sopenharmony_ci* please read the ICU user guide section <a href="https://unicode-org.github.io/icu/userguide/datetime/timezone#updating-the-time-zone-data"> 15407777dab0Sopenharmony_ci* Updating the Time Zone Data</a>. 15417777dab0Sopenharmony_ci* 15427777dab0Sopenharmony_ci* @param id A system time zone ID. 15437777dab0Sopenharmony_ci* @param len The length of <code>id</code>, or -1 if null-terminated. 15447777dab0Sopenharmony_ci* @param winid A buffer to receive a Windows time zone ID. 15457777dab0Sopenharmony_ci* @param winidCapacity The capacity of the result buffer <code>winid</code>. 15467777dab0Sopenharmony_ci* @param status Receives the status. 15477777dab0Sopenharmony_ci* @return The result string length, not including the terminating null. 15487777dab0Sopenharmony_ci* @see ucal_getTimeZoneIDForWindowsID 15497777dab0Sopenharmony_ci* 15507777dab0Sopenharmony_ci* @stable ICU 52 15517777dab0Sopenharmony_ci*/ 15527777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 15537777dab0Sopenharmony_ciucal_getWindowsTimeZoneID(const UChar* id, int32_t len, 15547777dab0Sopenharmony_ci UChar* winid, int32_t winidCapacity, UErrorCode* status); 15557777dab0Sopenharmony_ci 15567777dab0Sopenharmony_ci/** 15577777dab0Sopenharmony_ci* Converts a Windows time zone ID to an equivalent system time zone ID 15587777dab0Sopenharmony_ci* for a region. For example, system time zone ID "America/Los_Angeles" is returned 15597777dab0Sopenharmony_ci* for input Windows ID "Pacific Standard Time" and region "US" (or <code>null</code>), 15607777dab0Sopenharmony_ci* "America/Vancouver" is returned for the same Windows ID "Pacific Standard Time" and 15617777dab0Sopenharmony_ci* region "CA". 15627777dab0Sopenharmony_ci* 15637777dab0Sopenharmony_ci* <p>Not all Windows time zones can be mapped to system time zones. When the input 15647777dab0Sopenharmony_ci* Windows time zone ID is unknown or unmappable to a system time zone, then this 15657777dab0Sopenharmony_ci* function returns 0 as the result length, but the operation itself remains successful 15667777dab0Sopenharmony_ci* (no error status set on return). 15677777dab0Sopenharmony_ci* 15687777dab0Sopenharmony_ci* <p>This implementation utilizes <a href="http://unicode.org/cldr/charts/supplemental/zone_tzid.html"> 15697777dab0Sopenharmony_ci* Zone-Tzid mapping data</a>. The mapping data is updated time to time. To get the latest changes, 15707777dab0Sopenharmony_ci* please read the ICU user guide section <a href="https://unicode-org.github.io/icu/userguide/datetime/timezone#updating-the-time-zone-data"> 15717777dab0Sopenharmony_ci* Updating the Time Zone Data</a>. 15727777dab0Sopenharmony_ci* 15737777dab0Sopenharmony_ci* @param winid A Windows time zone ID. 15747777dab0Sopenharmony_ci* @param len The length of <code>winid</code>, or -1 if null-terminated. 15757777dab0Sopenharmony_ci* @param region A null-terminated region code, or <code>NULL</code> if no regional preference. 15767777dab0Sopenharmony_ci* @param id A buffer to receive a system time zone ID. 15777777dab0Sopenharmony_ci* @param idCapacity The capacity of the result buffer <code>id</code>. 15787777dab0Sopenharmony_ci* @param status Receives the status. 15797777dab0Sopenharmony_ci* @return The result string length, not including the terminating null. 15807777dab0Sopenharmony_ci* @see ucal_getWindowsTimeZoneID 15817777dab0Sopenharmony_ci* 15827777dab0Sopenharmony_ci* @stable ICU 52 15837777dab0Sopenharmony_ci*/ 15847777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 15857777dab0Sopenharmony_ciucal_getTimeZoneIDForWindowsID(const UChar* winid, int32_t len, const char* region, 15867777dab0Sopenharmony_ci UChar* id, int32_t idCapacity, UErrorCode* status); 15877777dab0Sopenharmony_ci 15887777dab0Sopenharmony_ci/** 15897777dab0Sopenharmony_ci * Options used by ucal_getTimeZoneOffsetFromLocal and BasicTimeZone::getOffsetFromLocal() 15907777dab0Sopenharmony_ci * to specify how to interpret an input time when it does not exist, or when it is ambiguous, 15917777dab0Sopenharmony_ci * around a time zone transition. 15927777dab0Sopenharmony_ci * @stable ICU 69 15937777dab0Sopenharmony_ci */ 15947777dab0Sopenharmony_cienum UTimeZoneLocalOption { 15957777dab0Sopenharmony_ci /** 15967777dab0Sopenharmony_ci * An input time is always interpreted as local time before 15977777dab0Sopenharmony_ci * a time zone transition. 15987777dab0Sopenharmony_ci * @stable ICU 69 15997777dab0Sopenharmony_ci */ 16007777dab0Sopenharmony_ci UCAL_TZ_LOCAL_FORMER = 0x04, 16017777dab0Sopenharmony_ci /** 16027777dab0Sopenharmony_ci * An input time is always interpreted as local time after 16037777dab0Sopenharmony_ci * a time zone transition. 16047777dab0Sopenharmony_ci * @stable ICU 69 16057777dab0Sopenharmony_ci */ 16067777dab0Sopenharmony_ci UCAL_TZ_LOCAL_LATTER = 0x0C, 16077777dab0Sopenharmony_ci /** 16087777dab0Sopenharmony_ci * An input time is interpreted as standard time when local 16097777dab0Sopenharmony_ci * time is switched to/from daylight saving time. When both 16107777dab0Sopenharmony_ci * sides of a time zone transition are standard time, 16117777dab0Sopenharmony_ci * or daylight saving time, the local time before the 16127777dab0Sopenharmony_ci * transition is used. 16137777dab0Sopenharmony_ci * @stable ICU 69 16147777dab0Sopenharmony_ci */ 16157777dab0Sopenharmony_ci UCAL_TZ_LOCAL_STANDARD_FORMER = UCAL_TZ_LOCAL_FORMER | 0x01, 16167777dab0Sopenharmony_ci /** 16177777dab0Sopenharmony_ci * An input time is interpreted as standard time when local 16187777dab0Sopenharmony_ci * time is switched to/from daylight saving time. When both 16197777dab0Sopenharmony_ci * sides of a time zone transition are standard time, 16207777dab0Sopenharmony_ci * or daylight saving time, the local time after the 16217777dab0Sopenharmony_ci * transition is used. 16227777dab0Sopenharmony_ci * @stable ICU 69 16237777dab0Sopenharmony_ci */ 16247777dab0Sopenharmony_ci UCAL_TZ_LOCAL_STANDARD_LATTER = UCAL_TZ_LOCAL_LATTER | 0x01, 16257777dab0Sopenharmony_ci /** 16267777dab0Sopenharmony_ci * An input time is interpreted as daylight saving time when 16277777dab0Sopenharmony_ci * local time is switched to/from standard time. When both 16287777dab0Sopenharmony_ci * sides of a time zone transition are standard time, 16297777dab0Sopenharmony_ci * or daylight saving time, the local time before the 16307777dab0Sopenharmony_ci * transition is used. 16317777dab0Sopenharmony_ci * @stable ICU 69 16327777dab0Sopenharmony_ci */ 16337777dab0Sopenharmony_ci UCAL_TZ_LOCAL_DAYLIGHT_FORMER = UCAL_TZ_LOCAL_FORMER | 0x03, 16347777dab0Sopenharmony_ci /** 16357777dab0Sopenharmony_ci * An input time is interpreted as daylight saving time when 16367777dab0Sopenharmony_ci * local time is switched to/from standard time. When both 16377777dab0Sopenharmony_ci * sides of a time zone transition are standard time, 16387777dab0Sopenharmony_ci * or daylight saving time, the local time after the 16397777dab0Sopenharmony_ci * transition is used. 16407777dab0Sopenharmony_ci * @stable ICU 69 16417777dab0Sopenharmony_ci */ 16427777dab0Sopenharmony_ci UCAL_TZ_LOCAL_DAYLIGHT_LATTER = UCAL_TZ_LOCAL_LATTER | 0x03, 16437777dab0Sopenharmony_ci}; 16447777dab0Sopenharmony_citypedef enum UTimeZoneLocalOption UTimeZoneLocalOption; /**< @stable ICU 69 */ 16457777dab0Sopenharmony_ci 16467777dab0Sopenharmony_ci/** 16477777dab0Sopenharmony_ci* Returns the time zone raw and GMT offset for the given moment 16487777dab0Sopenharmony_ci* in time. Upon return, local-millis = GMT-millis + rawOffset + 16497777dab0Sopenharmony_ci* dstOffset. All computations are performed in the proleptic 16507777dab0Sopenharmony_ci* Gregorian calendar. 16517777dab0Sopenharmony_ci* 16527777dab0Sopenharmony_ci* @param cal The UCalendar which specify the local date and time value to query. 16537777dab0Sopenharmony_ci* @param nonExistingTimeOpt The option to indicate how to interpret the date and 16547777dab0Sopenharmony_ci* time in the calendar represent a local time that skipped at a positive time 16557777dab0Sopenharmony_ci* zone transitions (e.g. when the daylight saving time starts or the time zone 16567777dab0Sopenharmony_ci* offset is increased due to a time zone rule change). 16577777dab0Sopenharmony_ci* @param duplicatedTimeOpt The option to indicate how to interpret the date and 16587777dab0Sopenharmony_ci* time in the calendar represent a local time that repeating multiple times at a 16597777dab0Sopenharmony_ci* negative time zone transition (e.g. when the daylight saving time ends or the 16607777dab0Sopenharmony_ci* time zone offset is decreased due to a time zone rule change) 16617777dab0Sopenharmony_ci* @param rawOffset output parameter to receive the raw offset, that 16627777dab0Sopenharmony_ci* is, the offset not including DST adjustments. 16637777dab0Sopenharmony_ci* If the status is set to one of the error code, the value set is unspecified. 16647777dab0Sopenharmony_ci* @param dstOffset output parameter to receive the DST offset, 16657777dab0Sopenharmony_ci* that is, the offset to be added to `rawOffset' to obtain the 16667777dab0Sopenharmony_ci* total offset between local and GMT time. If DST is not in 16677777dab0Sopenharmony_ci* effect, this value is zero; otherwise it is a positive value, 16687777dab0Sopenharmony_ci* typically one hour. 16697777dab0Sopenharmony_ci* If the status is set to one of the error code, the value set is unspecified. 16707777dab0Sopenharmony_ci* @param status A pointer to a UErrorCode to receive any errors. 16717777dab0Sopenharmony_ci* @stable ICU 69 16727777dab0Sopenharmony_ci*/ 16737777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 16747777dab0Sopenharmony_ciucal_getTimeZoneOffsetFromLocal( 16757777dab0Sopenharmony_ci const UCalendar* cal, 16767777dab0Sopenharmony_ci UTimeZoneLocalOption nonExistingTimeOpt, 16777777dab0Sopenharmony_ci UTimeZoneLocalOption duplicatedTimeOpt, 16787777dab0Sopenharmony_ci int32_t* rawOffset, int32_t* dstOffset, UErrorCode* status); 16797777dab0Sopenharmony_ci 16807777dab0Sopenharmony_ci#endif /* #if !UCONFIG_NO_FORMATTING */ 16817777dab0Sopenharmony_ci 16827777dab0Sopenharmony_ci#endif 1683