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-2016, International Business Machines 67777dab0Sopenharmony_ci * Corporation and others. All Rights Reserved. 77777dab0Sopenharmony_ci ******************************************************************************* 87777dab0Sopenharmony_ci*/ 97777dab0Sopenharmony_ci 107777dab0Sopenharmony_ci#ifndef UDAT_H 117777dab0Sopenharmony_ci#define UDAT_H 127777dab0Sopenharmony_ci 137777dab0Sopenharmony_ci#include "unicode/utypes.h" 147777dab0Sopenharmony_ci 157777dab0Sopenharmony_ci#if !UCONFIG_NO_FORMATTING 167777dab0Sopenharmony_ci 177777dab0Sopenharmony_ci#include "unicode/ucal.h" 187777dab0Sopenharmony_ci#include "unicode/unum.h" 197777dab0Sopenharmony_ci#include "unicode/udisplaycontext.h" 207777dab0Sopenharmony_ci#include "unicode/ufieldpositer.h" 217777dab0Sopenharmony_ci 227777dab0Sopenharmony_ci#if U_SHOW_CPLUSPLUS_API 237777dab0Sopenharmony_ci#include "unicode/localpointer.h" 247777dab0Sopenharmony_ci#endif // U_SHOW_CPLUSPLUS_API 257777dab0Sopenharmony_ci 267777dab0Sopenharmony_ci/** 277777dab0Sopenharmony_ci * \file 287777dab0Sopenharmony_ci * \brief C API: DateFormat 297777dab0Sopenharmony_ci * 307777dab0Sopenharmony_ci * <h2> Date Format C API</h2> 317777dab0Sopenharmony_ci * 327777dab0Sopenharmony_ci * Date Format C API consists of functions that convert dates and 337777dab0Sopenharmony_ci * times from their internal representations to textual form and back again in a 347777dab0Sopenharmony_ci * language-independent manner. Converting from the internal representation (milliseconds 357777dab0Sopenharmony_ci * since midnight, January 1, 1970) to text is known as "formatting," and converting 367777dab0Sopenharmony_ci * from text to millis is known as "parsing." We currently define only one concrete 377777dab0Sopenharmony_ci * structure UDateFormat, which can handle pretty much all normal 387777dab0Sopenharmony_ci * date formatting and parsing actions. 397777dab0Sopenharmony_ci * <P> 407777dab0Sopenharmony_ci * Date Format helps you to format and parse dates for any locale. Your code can 417777dab0Sopenharmony_ci * be completely independent of the locale conventions for months, days of the 427777dab0Sopenharmony_ci * week, or even the calendar format: lunar vs. solar. 437777dab0Sopenharmony_ci * <P> 447777dab0Sopenharmony_ci * To format a date for the current Locale with default time and date style, 457777dab0Sopenharmony_ci * use one of the static factory methods: 467777dab0Sopenharmony_ci * <pre> 477777dab0Sopenharmony_ci * \code 487777dab0Sopenharmony_ci * UErrorCode status = U_ZERO_ERROR; 497777dab0Sopenharmony_ci * UChar *myString; 507777dab0Sopenharmony_ci * int32_t myStrlen = 0; 517777dab0Sopenharmony_ci * UDateFormat* dfmt = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, NULL, NULL, -1, NULL, -1, &status); 527777dab0Sopenharmony_ci * myStrlen = udat_format(dfmt, myDate, NULL, myStrlen, NULL, &status); 537777dab0Sopenharmony_ci * if (status==U_BUFFER_OVERFLOW_ERROR){ 547777dab0Sopenharmony_ci * status=U_ZERO_ERROR; 557777dab0Sopenharmony_ci * myString=(UChar*)malloc(sizeof(UChar) * (myStrlen+1) ); 567777dab0Sopenharmony_ci * udat_format(dfmt, myDate, myString, myStrlen+1, NULL, &status); 577777dab0Sopenharmony_ci * } 587777dab0Sopenharmony_ci * \endcode 597777dab0Sopenharmony_ci * </pre> 607777dab0Sopenharmony_ci * If you are formatting multiple numbers, it is more efficient to get the 617777dab0Sopenharmony_ci * format and use it multiple times so that the system doesn't have to fetch the 627777dab0Sopenharmony_ci * information about the local language and country conventions multiple times. 637777dab0Sopenharmony_ci * <pre> 647777dab0Sopenharmony_ci * \code 657777dab0Sopenharmony_ci * UErrorCode status = U_ZERO_ERROR; 667777dab0Sopenharmony_ci * int32_t i, myStrlen = 0; 677777dab0Sopenharmony_ci * UChar* myString; 687777dab0Sopenharmony_ci * char buffer[1024]; 697777dab0Sopenharmony_ci * UDate myDateArr[] = { 0.0, 100000000.0, 2000000000.0 }; // test values 707777dab0Sopenharmony_ci * UDateFormat* df = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, NULL, NULL, -1, NULL, 0, &status); 717777dab0Sopenharmony_ci * for (i = 0; i < 3; i++) { 727777dab0Sopenharmony_ci * myStrlen = udat_format(df, myDateArr[i], NULL, myStrlen, NULL, &status); 737777dab0Sopenharmony_ci * if(status == U_BUFFER_OVERFLOW_ERROR){ 747777dab0Sopenharmony_ci * status = U_ZERO_ERROR; 757777dab0Sopenharmony_ci * myString = (UChar*)malloc(sizeof(UChar) * (myStrlen+1) ); 767777dab0Sopenharmony_ci * udat_format(df, myDateArr[i], myString, myStrlen+1, NULL, &status); 777777dab0Sopenharmony_ci * printf("%s\n", u_austrcpy(buffer, myString) ); 787777dab0Sopenharmony_ci * free(myString); 797777dab0Sopenharmony_ci * } 807777dab0Sopenharmony_ci * } 817777dab0Sopenharmony_ci * \endcode 827777dab0Sopenharmony_ci * </pre> 837777dab0Sopenharmony_ci * To get specific fields of a date, you can use UFieldPosition to 847777dab0Sopenharmony_ci * get specific fields. 857777dab0Sopenharmony_ci * <pre> 867777dab0Sopenharmony_ci * \code 877777dab0Sopenharmony_ci * UErrorCode status = U_ZERO_ERROR; 887777dab0Sopenharmony_ci * UFieldPosition pos; 897777dab0Sopenharmony_ci * UChar *myString; 907777dab0Sopenharmony_ci * int32_t myStrlen = 0; 917777dab0Sopenharmony_ci * char buffer[1024]; 927777dab0Sopenharmony_ci * 937777dab0Sopenharmony_ci * pos.field = 1; // Same as the DateFormat::EField enum 947777dab0Sopenharmony_ci * UDateFormat* dfmt = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, NULL, -1, NULL, 0, &status); 957777dab0Sopenharmony_ci * myStrlen = udat_format(dfmt, myDate, NULL, myStrlen, &pos, &status); 967777dab0Sopenharmony_ci * if (status==U_BUFFER_OVERFLOW_ERROR){ 977777dab0Sopenharmony_ci * status=U_ZERO_ERROR; 987777dab0Sopenharmony_ci * myString=(UChar*)malloc(sizeof(UChar) * (myStrlen+1) ); 997777dab0Sopenharmony_ci * udat_format(dfmt, myDate, myString, myStrlen+1, &pos, &status); 1007777dab0Sopenharmony_ci * } 1017777dab0Sopenharmony_ci * printf("date format: %s\n", u_austrcpy(buffer, myString)); 1027777dab0Sopenharmony_ci * buffer[pos.endIndex] = 0; // NULL terminate the string. 1037777dab0Sopenharmony_ci * printf("UFieldPosition position equals %s\n", &buffer[pos.beginIndex]); 1047777dab0Sopenharmony_ci * \endcode 1057777dab0Sopenharmony_ci * </pre> 1067777dab0Sopenharmony_ci * To format a date for a different Locale, specify it in the call to 1077777dab0Sopenharmony_ci * udat_open() 1087777dab0Sopenharmony_ci * <pre> 1097777dab0Sopenharmony_ci * \code 1107777dab0Sopenharmony_ci * UDateFormat* df = udat_open(UDAT_SHORT, UDAT_SHORT, "fr_FR", NULL, -1, NULL, 0, &status); 1117777dab0Sopenharmony_ci * \endcode 1127777dab0Sopenharmony_ci * </pre> 1137777dab0Sopenharmony_ci * You can use a DateFormat API udat_parse() to parse. 1147777dab0Sopenharmony_ci * <pre> 1157777dab0Sopenharmony_ci * \code 1167777dab0Sopenharmony_ci * UErrorCode status = U_ZERO_ERROR; 1177777dab0Sopenharmony_ci * int32_t parsepos=0; 1187777dab0Sopenharmony_ci * UDate myDate = udat_parse(df, myString, u_strlen(myString), &parsepos, &status); 1197777dab0Sopenharmony_ci * \endcode 1207777dab0Sopenharmony_ci * </pre> 1217777dab0Sopenharmony_ci * You can pass in different options for the arguments for date and time style 1227777dab0Sopenharmony_ci * to control the length of the result; from SHORT to MEDIUM to LONG to FULL. 1237777dab0Sopenharmony_ci * The exact result depends on the locale, but generally: 1247777dab0Sopenharmony_ci * see UDateFormatStyle for more details 1257777dab0Sopenharmony_ci * <ul type=round> 1267777dab0Sopenharmony_ci * <li> UDAT_SHORT is completely numeric, such as 12/13/52 or 3:30pm 1277777dab0Sopenharmony_ci * <li> UDAT_MEDIUM is longer, such as Jan 12, 1952 1287777dab0Sopenharmony_ci * <li> UDAT_LONG is longer, such as January 12, 1952 or 3:30:32pm 1297777dab0Sopenharmony_ci * <li> UDAT_FULL is pretty completely specified, such as 1307777dab0Sopenharmony_ci * Tuesday, April 12, 1952 AD or 3:30:42pm PST. 1317777dab0Sopenharmony_ci * </ul> 1327777dab0Sopenharmony_ci * You can also set the time zone on the format if you wish. 1337777dab0Sopenharmony_ci * <P> 1347777dab0Sopenharmony_ci * You can also use forms of the parse and format methods with Parse Position and 1357777dab0Sopenharmony_ci * UFieldPosition to allow you to 1367777dab0Sopenharmony_ci * <ul type=round> 1377777dab0Sopenharmony_ci * <li> Progressively parse through pieces of a string. 1387777dab0Sopenharmony_ci * <li> Align any particular field, or find out where it is for selection 1397777dab0Sopenharmony_ci * on the screen. 1407777dab0Sopenharmony_ci * </ul> 1417777dab0Sopenharmony_ci * <p><strong>Date and Time Patterns:</strong></p> 1427777dab0Sopenharmony_ci * 1437777dab0Sopenharmony_ci * <p>Date and time formats are specified by <em>date and time pattern</em> strings. 1447777dab0Sopenharmony_ci * Within date and time pattern strings, all unquoted ASCII letters [A-Za-z] are reserved 1457777dab0Sopenharmony_ci * as pattern letters representing calendar fields. <code>UDateFormat</code> supports 1467777dab0Sopenharmony_ci * the date and time formatting algorithm and pattern letters defined by 1477777dab0Sopenharmony_ci * <a href="http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table">UTS#35 1487777dab0Sopenharmony_ci * Unicode Locale Data Markup Language (LDML)</a> and further documented for ICU in the 1497777dab0Sopenharmony_ci * <a href="https://unicode-org.github.io/icu/userguide/format_parse/datetime#date-field-symbol-table">ICU 1507777dab0Sopenharmony_ci * User Guide</a>.</p> 1517777dab0Sopenharmony_ci */ 1527777dab0Sopenharmony_ci 1537777dab0Sopenharmony_ci/** A date formatter. 1547777dab0Sopenharmony_ci * For usage in C programs. 1557777dab0Sopenharmony_ci * @stable ICU 2.6 1567777dab0Sopenharmony_ci */ 1577777dab0Sopenharmony_citypedef void* UDateFormat; 1587777dab0Sopenharmony_ci 1597777dab0Sopenharmony_ci/** The possible date/time format styles 1607777dab0Sopenharmony_ci * @stable ICU 2.6 1617777dab0Sopenharmony_ci */ 1627777dab0Sopenharmony_citypedef enum UDateFormatStyle { 1637777dab0Sopenharmony_ci /** Full style */ 1647777dab0Sopenharmony_ci UDAT_FULL, 1657777dab0Sopenharmony_ci /** Long style */ 1667777dab0Sopenharmony_ci UDAT_LONG, 1677777dab0Sopenharmony_ci /** Medium style */ 1687777dab0Sopenharmony_ci UDAT_MEDIUM, 1697777dab0Sopenharmony_ci /** Short style */ 1707777dab0Sopenharmony_ci UDAT_SHORT, 1717777dab0Sopenharmony_ci /** Default style */ 1727777dab0Sopenharmony_ci UDAT_DEFAULT = UDAT_MEDIUM, 1737777dab0Sopenharmony_ci 1747777dab0Sopenharmony_ci /** Bitfield for relative date */ 1757777dab0Sopenharmony_ci UDAT_RELATIVE = (1 << 7), 1767777dab0Sopenharmony_ci 1777777dab0Sopenharmony_ci UDAT_FULL_RELATIVE = UDAT_FULL | UDAT_RELATIVE, 1787777dab0Sopenharmony_ci 1797777dab0Sopenharmony_ci UDAT_LONG_RELATIVE = UDAT_LONG | UDAT_RELATIVE, 1807777dab0Sopenharmony_ci 1817777dab0Sopenharmony_ci UDAT_MEDIUM_RELATIVE = UDAT_MEDIUM | UDAT_RELATIVE, 1827777dab0Sopenharmony_ci 1837777dab0Sopenharmony_ci UDAT_SHORT_RELATIVE = UDAT_SHORT | UDAT_RELATIVE, 1847777dab0Sopenharmony_ci 1857777dab0Sopenharmony_ci 1867777dab0Sopenharmony_ci /** No style */ 1877777dab0Sopenharmony_ci UDAT_NONE = -1, 1887777dab0Sopenharmony_ci 1897777dab0Sopenharmony_ci /** 1907777dab0Sopenharmony_ci * Use the pattern given in the parameter to udat_open 1917777dab0Sopenharmony_ci * @see udat_open 1927777dab0Sopenharmony_ci * @stable ICU 50 1937777dab0Sopenharmony_ci */ 1947777dab0Sopenharmony_ci UDAT_PATTERN = -2, 1957777dab0Sopenharmony_ci 1967777dab0Sopenharmony_ci#ifndef U_HIDE_INTERNAL_API 1977777dab0Sopenharmony_ci /** @internal alias to UDAT_PATTERN */ 1987777dab0Sopenharmony_ci UDAT_IGNORE = UDAT_PATTERN 1997777dab0Sopenharmony_ci#endif /* U_HIDE_INTERNAL_API */ 2007777dab0Sopenharmony_ci} UDateFormatStyle; 2017777dab0Sopenharmony_ci 2027777dab0Sopenharmony_ci/* Skeletons for dates. */ 2037777dab0Sopenharmony_ci 2047777dab0Sopenharmony_ci/** 2057777dab0Sopenharmony_ci * Constant for date skeleton with year. 2067777dab0Sopenharmony_ci * @stable ICU 4.0 2077777dab0Sopenharmony_ci */ 2087777dab0Sopenharmony_ci#define UDAT_YEAR "y" 2097777dab0Sopenharmony_ci/** 2107777dab0Sopenharmony_ci * Constant for date skeleton with quarter. 2117777dab0Sopenharmony_ci * @stable ICU 51 2127777dab0Sopenharmony_ci */ 2137777dab0Sopenharmony_ci#define UDAT_QUARTER "QQQQ" 2147777dab0Sopenharmony_ci/** 2157777dab0Sopenharmony_ci * Constant for date skeleton with abbreviated quarter. 2167777dab0Sopenharmony_ci * @stable ICU 51 2177777dab0Sopenharmony_ci */ 2187777dab0Sopenharmony_ci#define UDAT_ABBR_QUARTER "QQQ" 2197777dab0Sopenharmony_ci/** 2207777dab0Sopenharmony_ci * Constant for date skeleton with year and quarter. 2217777dab0Sopenharmony_ci * @stable ICU 4.0 2227777dab0Sopenharmony_ci */ 2237777dab0Sopenharmony_ci#define UDAT_YEAR_QUARTER "yQQQQ" 2247777dab0Sopenharmony_ci/** 2257777dab0Sopenharmony_ci * Constant for date skeleton with year and abbreviated quarter. 2267777dab0Sopenharmony_ci * @stable ICU 4.0 2277777dab0Sopenharmony_ci */ 2287777dab0Sopenharmony_ci#define UDAT_YEAR_ABBR_QUARTER "yQQQ" 2297777dab0Sopenharmony_ci/** 2307777dab0Sopenharmony_ci * Constant for date skeleton with month. 2317777dab0Sopenharmony_ci * @stable ICU 4.0 2327777dab0Sopenharmony_ci */ 2337777dab0Sopenharmony_ci#define UDAT_MONTH "MMMM" 2347777dab0Sopenharmony_ci/** 2357777dab0Sopenharmony_ci * Constant for date skeleton with abbreviated month. 2367777dab0Sopenharmony_ci * @stable ICU 4.0 2377777dab0Sopenharmony_ci */ 2387777dab0Sopenharmony_ci#define UDAT_ABBR_MONTH "MMM" 2397777dab0Sopenharmony_ci/** 2407777dab0Sopenharmony_ci * Constant for date skeleton with numeric month. 2417777dab0Sopenharmony_ci * @stable ICU 4.0 2427777dab0Sopenharmony_ci */ 2437777dab0Sopenharmony_ci#define UDAT_NUM_MONTH "M" 2447777dab0Sopenharmony_ci/** 2457777dab0Sopenharmony_ci * Constant for date skeleton with year and month. 2467777dab0Sopenharmony_ci * @stable ICU 4.0 2477777dab0Sopenharmony_ci */ 2487777dab0Sopenharmony_ci#define UDAT_YEAR_MONTH "yMMMM" 2497777dab0Sopenharmony_ci/** 2507777dab0Sopenharmony_ci * Constant for date skeleton with year and abbreviated month. 2517777dab0Sopenharmony_ci * @stable ICU 4.0 2527777dab0Sopenharmony_ci */ 2537777dab0Sopenharmony_ci#define UDAT_YEAR_ABBR_MONTH "yMMM" 2547777dab0Sopenharmony_ci/** 2557777dab0Sopenharmony_ci * Constant for date skeleton with year and numeric month. 2567777dab0Sopenharmony_ci * @stable ICU 4.0 2577777dab0Sopenharmony_ci */ 2587777dab0Sopenharmony_ci#define UDAT_YEAR_NUM_MONTH "yM" 2597777dab0Sopenharmony_ci/** 2607777dab0Sopenharmony_ci * Constant for date skeleton with day. 2617777dab0Sopenharmony_ci * @stable ICU 4.0 2627777dab0Sopenharmony_ci */ 2637777dab0Sopenharmony_ci#define UDAT_DAY "d" 2647777dab0Sopenharmony_ci/** 2657777dab0Sopenharmony_ci * Constant for date skeleton with year, month, and day. 2667777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 2677777dab0Sopenharmony_ci * @stable ICU 4.0 2687777dab0Sopenharmony_ci */ 2697777dab0Sopenharmony_ci#define UDAT_YEAR_MONTH_DAY "yMMMMd" 2707777dab0Sopenharmony_ci/** 2717777dab0Sopenharmony_ci * Constant for date skeleton with year, abbreviated month, and day. 2727777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 2737777dab0Sopenharmony_ci * @stable ICU 4.0 2747777dab0Sopenharmony_ci */ 2757777dab0Sopenharmony_ci#define UDAT_YEAR_ABBR_MONTH_DAY "yMMMd" 2767777dab0Sopenharmony_ci/** 2777777dab0Sopenharmony_ci * Constant for date skeleton with year, numeric month, and day. 2787777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 2797777dab0Sopenharmony_ci * @stable ICU 4.0 2807777dab0Sopenharmony_ci */ 2817777dab0Sopenharmony_ci#define UDAT_YEAR_NUM_MONTH_DAY "yMd" 2827777dab0Sopenharmony_ci/** 2837777dab0Sopenharmony_ci * Constant for date skeleton with weekday. 2847777dab0Sopenharmony_ci * @stable ICU 51 2857777dab0Sopenharmony_ci */ 2867777dab0Sopenharmony_ci#define UDAT_WEEKDAY "EEEE" 2877777dab0Sopenharmony_ci/** 2887777dab0Sopenharmony_ci * Constant for date skeleton with abbreviated weekday. 2897777dab0Sopenharmony_ci * @stable ICU 51 2907777dab0Sopenharmony_ci */ 2917777dab0Sopenharmony_ci#define UDAT_ABBR_WEEKDAY "E" 2927777dab0Sopenharmony_ci/** 2937777dab0Sopenharmony_ci * Constant for date skeleton with year, month, weekday, and day. 2947777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 2957777dab0Sopenharmony_ci * @stable ICU 4.0 2967777dab0Sopenharmony_ci */ 2977777dab0Sopenharmony_ci#define UDAT_YEAR_MONTH_WEEKDAY_DAY "yMMMMEEEEd" 2987777dab0Sopenharmony_ci/** 2997777dab0Sopenharmony_ci * Constant for date skeleton with year, abbreviated month, weekday, and day. 3007777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 3017777dab0Sopenharmony_ci * @stable ICU 4.0 3027777dab0Sopenharmony_ci */ 3037777dab0Sopenharmony_ci#define UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY "yMMMEd" 3047777dab0Sopenharmony_ci/** 3057777dab0Sopenharmony_ci * Constant for date skeleton with year, numeric month, weekday, and day. 3067777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 3077777dab0Sopenharmony_ci * @stable ICU 4.0 3087777dab0Sopenharmony_ci */ 3097777dab0Sopenharmony_ci#define UDAT_YEAR_NUM_MONTH_WEEKDAY_DAY "yMEd" 3107777dab0Sopenharmony_ci/** 3117777dab0Sopenharmony_ci * Constant for date skeleton with long month and day. 3127777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 3137777dab0Sopenharmony_ci * @stable ICU 4.0 3147777dab0Sopenharmony_ci */ 3157777dab0Sopenharmony_ci#define UDAT_MONTH_DAY "MMMMd" 3167777dab0Sopenharmony_ci/** 3177777dab0Sopenharmony_ci * Constant for date skeleton with abbreviated month and day. 3187777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 3197777dab0Sopenharmony_ci * @stable ICU 4.0 3207777dab0Sopenharmony_ci */ 3217777dab0Sopenharmony_ci#define UDAT_ABBR_MONTH_DAY "MMMd" 3227777dab0Sopenharmony_ci/** 3237777dab0Sopenharmony_ci * Constant for date skeleton with numeric month and day. 3247777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 3257777dab0Sopenharmony_ci * @stable ICU 4.0 3267777dab0Sopenharmony_ci */ 3277777dab0Sopenharmony_ci#define UDAT_NUM_MONTH_DAY "Md" 3287777dab0Sopenharmony_ci/** 3297777dab0Sopenharmony_ci * Constant for date skeleton with month, weekday, and day. 3307777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 3317777dab0Sopenharmony_ci * @stable ICU 4.0 3327777dab0Sopenharmony_ci */ 3337777dab0Sopenharmony_ci#define UDAT_MONTH_WEEKDAY_DAY "MMMMEEEEd" 3347777dab0Sopenharmony_ci/** 3357777dab0Sopenharmony_ci * Constant for date skeleton with abbreviated month, weekday, and day. 3367777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 3377777dab0Sopenharmony_ci * @stable ICU 4.0 3387777dab0Sopenharmony_ci */ 3397777dab0Sopenharmony_ci#define UDAT_ABBR_MONTH_WEEKDAY_DAY "MMMEd" 3407777dab0Sopenharmony_ci/** 3417777dab0Sopenharmony_ci * Constant for date skeleton with numeric month, weekday, and day. 3427777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 3437777dab0Sopenharmony_ci * @stable ICU 4.0 3447777dab0Sopenharmony_ci */ 3457777dab0Sopenharmony_ci#define UDAT_NUM_MONTH_WEEKDAY_DAY "MEd" 3467777dab0Sopenharmony_ci 3477777dab0Sopenharmony_ci/* Skeletons for times. */ 3487777dab0Sopenharmony_ci 3497777dab0Sopenharmony_ci/** 3507777dab0Sopenharmony_ci * Constant for date skeleton with hour, with the locale's preferred hour format (12 or 24). 3517777dab0Sopenharmony_ci * @stable ICU 4.0 3527777dab0Sopenharmony_ci */ 3537777dab0Sopenharmony_ci#define UDAT_HOUR "j" 3547777dab0Sopenharmony_ci/** 3557777dab0Sopenharmony_ci * Constant for date skeleton with hour in 24-hour presentation. 3567777dab0Sopenharmony_ci * @stable ICU 51 3577777dab0Sopenharmony_ci */ 3587777dab0Sopenharmony_ci#define UDAT_HOUR24 "H" 3597777dab0Sopenharmony_ci/** 3607777dab0Sopenharmony_ci * Constant for date skeleton with minute. 3617777dab0Sopenharmony_ci * @stable ICU 51 3627777dab0Sopenharmony_ci */ 3637777dab0Sopenharmony_ci#define UDAT_MINUTE "m" 3647777dab0Sopenharmony_ci/** 3657777dab0Sopenharmony_ci * Constant for date skeleton with hour and minute, with the locale's preferred hour format (12 or 24). 3667777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 3677777dab0Sopenharmony_ci * @stable ICU 4.0 3687777dab0Sopenharmony_ci */ 3697777dab0Sopenharmony_ci#define UDAT_HOUR_MINUTE "jm" 3707777dab0Sopenharmony_ci/** 3717777dab0Sopenharmony_ci * Constant for date skeleton with hour and minute in 24-hour presentation. 3727777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 3737777dab0Sopenharmony_ci * @stable ICU 4.0 3747777dab0Sopenharmony_ci */ 3757777dab0Sopenharmony_ci#define UDAT_HOUR24_MINUTE "Hm" 3767777dab0Sopenharmony_ci/** 3777777dab0Sopenharmony_ci * Constant for date skeleton with second. 3787777dab0Sopenharmony_ci * @stable ICU 51 3797777dab0Sopenharmony_ci */ 3807777dab0Sopenharmony_ci#define UDAT_SECOND "s" 3817777dab0Sopenharmony_ci/** 3827777dab0Sopenharmony_ci * Constant for date skeleton with hour, minute, and second, 3837777dab0Sopenharmony_ci * with the locale's preferred hour format (12 or 24). 3847777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 3857777dab0Sopenharmony_ci * @stable ICU 4.0 3867777dab0Sopenharmony_ci */ 3877777dab0Sopenharmony_ci#define UDAT_HOUR_MINUTE_SECOND "jms" 3887777dab0Sopenharmony_ci/** 3897777dab0Sopenharmony_ci * Constant for date skeleton with hour, minute, and second in 3907777dab0Sopenharmony_ci * 24-hour presentation. 3917777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 3927777dab0Sopenharmony_ci * @stable ICU 4.0 3937777dab0Sopenharmony_ci */ 3947777dab0Sopenharmony_ci#define UDAT_HOUR24_MINUTE_SECOND "Hms" 3957777dab0Sopenharmony_ci/** 3967777dab0Sopenharmony_ci * Constant for date skeleton with minute and second. 3977777dab0Sopenharmony_ci * Used in combinations date + time, date + time + zone, or time + zone. 3987777dab0Sopenharmony_ci * @stable ICU 4.0 3997777dab0Sopenharmony_ci */ 4007777dab0Sopenharmony_ci#define UDAT_MINUTE_SECOND "ms" 4017777dab0Sopenharmony_ci 4027777dab0Sopenharmony_ci/* Skeletons for time zones. */ 4037777dab0Sopenharmony_ci 4047777dab0Sopenharmony_ci/** 4057777dab0Sopenharmony_ci * Constant for <i>generic location format</i>, such as Los Angeles Time; 4067777dab0Sopenharmony_ci * used in combinations date + time + zone, or time + zone. 4077777dab0Sopenharmony_ci * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a> 4087777dab0Sopenharmony_ci * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a> 4097777dab0Sopenharmony_ci * @stable ICU 51 4107777dab0Sopenharmony_ci */ 4117777dab0Sopenharmony_ci#define UDAT_LOCATION_TZ "VVVV" 4127777dab0Sopenharmony_ci/** 4137777dab0Sopenharmony_ci * Constant for <i>generic non-location format</i>, such as Pacific Time; 4147777dab0Sopenharmony_ci * used in combinations date + time + zone, or time + zone. 4157777dab0Sopenharmony_ci * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a> 4167777dab0Sopenharmony_ci * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a> 4177777dab0Sopenharmony_ci * @stable ICU 51 4187777dab0Sopenharmony_ci */ 4197777dab0Sopenharmony_ci#define UDAT_GENERIC_TZ "vvvv" 4207777dab0Sopenharmony_ci/** 4217777dab0Sopenharmony_ci * Constant for <i>generic non-location format</i>, abbreviated if possible, such as PT; 4227777dab0Sopenharmony_ci * used in combinations date + time + zone, or time + zone. 4237777dab0Sopenharmony_ci * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a> 4247777dab0Sopenharmony_ci * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a> 4257777dab0Sopenharmony_ci * @stable ICU 51 4267777dab0Sopenharmony_ci */ 4277777dab0Sopenharmony_ci#define UDAT_ABBR_GENERIC_TZ "v" 4287777dab0Sopenharmony_ci/** 4297777dab0Sopenharmony_ci * Constant for <i>specific non-location format</i>, such as Pacific Daylight Time; 4307777dab0Sopenharmony_ci * used in combinations date + time + zone, or time + zone. 4317777dab0Sopenharmony_ci * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a> 4327777dab0Sopenharmony_ci * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a> 4337777dab0Sopenharmony_ci * @stable ICU 51 4347777dab0Sopenharmony_ci */ 4357777dab0Sopenharmony_ci#define UDAT_SPECIFIC_TZ "zzzz" 4367777dab0Sopenharmony_ci/** 4377777dab0Sopenharmony_ci * Constant for <i>specific non-location format</i>, abbreviated if possible, such as PDT; 4387777dab0Sopenharmony_ci * used in combinations date + time + zone, or time + zone. 4397777dab0Sopenharmony_ci * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a> 4407777dab0Sopenharmony_ci * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a> 4417777dab0Sopenharmony_ci * @stable ICU 51 4427777dab0Sopenharmony_ci */ 4437777dab0Sopenharmony_ci#define UDAT_ABBR_SPECIFIC_TZ "z" 4447777dab0Sopenharmony_ci/** 4457777dab0Sopenharmony_ci * Constant for <i>localized GMT/UTC format</i>, such as GMT+8:00 or HPG-8:00; 4467777dab0Sopenharmony_ci * used in combinations date + time + zone, or time + zone. 4477777dab0Sopenharmony_ci * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a> 4487777dab0Sopenharmony_ci * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a> 4497777dab0Sopenharmony_ci * @stable ICU 51 4507777dab0Sopenharmony_ci */ 4517777dab0Sopenharmony_ci#define UDAT_ABBR_UTC_TZ "ZZZZ" 4527777dab0Sopenharmony_ci 4537777dab0Sopenharmony_ci/** 4547777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selectors for format fields 4557777dab0Sopenharmony_ci * defined by DateFormat and UDateFormat. 4567777dab0Sopenharmony_ci * @stable ICU 3.0 4577777dab0Sopenharmony_ci */ 4587777dab0Sopenharmony_citypedef enum UDateFormatField { 4597777dab0Sopenharmony_ci /** 4607777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'G' field alignment, 4617777dab0Sopenharmony_ci * corresponding to the UCAL_ERA field. 4627777dab0Sopenharmony_ci * @stable ICU 3.0 4637777dab0Sopenharmony_ci */ 4647777dab0Sopenharmony_ci UDAT_ERA_FIELD = 0, 4657777dab0Sopenharmony_ci 4667777dab0Sopenharmony_ci /** 4677777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'y' field alignment, 4687777dab0Sopenharmony_ci * corresponding to the UCAL_YEAR field. 4697777dab0Sopenharmony_ci * @stable ICU 3.0 4707777dab0Sopenharmony_ci */ 4717777dab0Sopenharmony_ci UDAT_YEAR_FIELD = 1, 4727777dab0Sopenharmony_ci 4737777dab0Sopenharmony_ci /** 4747777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'M' field alignment, 4757777dab0Sopenharmony_ci * corresponding to the UCAL_MONTH field. 4767777dab0Sopenharmony_ci * @stable ICU 3.0 4777777dab0Sopenharmony_ci */ 4787777dab0Sopenharmony_ci UDAT_MONTH_FIELD = 2, 4797777dab0Sopenharmony_ci 4807777dab0Sopenharmony_ci /** 4817777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'd' field alignment, 4827777dab0Sopenharmony_ci * corresponding to the UCAL_DATE field. 4837777dab0Sopenharmony_ci * @stable ICU 3.0 4847777dab0Sopenharmony_ci */ 4857777dab0Sopenharmony_ci UDAT_DATE_FIELD = 3, 4867777dab0Sopenharmony_ci 4877777dab0Sopenharmony_ci /** 4887777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'k' field alignment, 4897777dab0Sopenharmony_ci * corresponding to the UCAL_HOUR_OF_DAY field. 4907777dab0Sopenharmony_ci * UDAT_HOUR_OF_DAY1_FIELD is used for the one-based 24-hour clock. 4917777dab0Sopenharmony_ci * For example, 23:59 + 01:00 results in 24:59. 4927777dab0Sopenharmony_ci * @stable ICU 3.0 4937777dab0Sopenharmony_ci */ 4947777dab0Sopenharmony_ci UDAT_HOUR_OF_DAY1_FIELD = 4, 4957777dab0Sopenharmony_ci 4967777dab0Sopenharmony_ci /** 4977777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'H' field alignment, 4987777dab0Sopenharmony_ci * corresponding to the UCAL_HOUR_OF_DAY field. 4997777dab0Sopenharmony_ci * UDAT_HOUR_OF_DAY0_FIELD is used for the zero-based 24-hour clock. 5007777dab0Sopenharmony_ci * For example, 23:59 + 01:00 results in 00:59. 5017777dab0Sopenharmony_ci * @stable ICU 3.0 5027777dab0Sopenharmony_ci */ 5037777dab0Sopenharmony_ci UDAT_HOUR_OF_DAY0_FIELD = 5, 5047777dab0Sopenharmony_ci 5057777dab0Sopenharmony_ci /** 5067777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'm' field alignment, 5077777dab0Sopenharmony_ci * corresponding to the UCAL_MINUTE field. 5087777dab0Sopenharmony_ci * @stable ICU 3.0 5097777dab0Sopenharmony_ci */ 5107777dab0Sopenharmony_ci UDAT_MINUTE_FIELD = 6, 5117777dab0Sopenharmony_ci 5127777dab0Sopenharmony_ci /** 5137777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 's' field alignment, 5147777dab0Sopenharmony_ci * corresponding to the UCAL_SECOND field. 5157777dab0Sopenharmony_ci * @stable ICU 3.0 5167777dab0Sopenharmony_ci */ 5177777dab0Sopenharmony_ci UDAT_SECOND_FIELD = 7, 5187777dab0Sopenharmony_ci 5197777dab0Sopenharmony_ci /** 5207777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'S' field alignment, 5217777dab0Sopenharmony_ci * corresponding to the UCAL_MILLISECOND field. 5227777dab0Sopenharmony_ci * 5237777dab0Sopenharmony_ci * Note: Time formats that use 'S' can display a maximum of three 5247777dab0Sopenharmony_ci * significant digits for fractional seconds, corresponding to millisecond 5257777dab0Sopenharmony_ci * resolution and a fractional seconds sub-pattern of SSS. If the 5267777dab0Sopenharmony_ci * sub-pattern is S or SS, the fractional seconds value will be truncated 5277777dab0Sopenharmony_ci * (not rounded) to the number of display places specified. If the 5287777dab0Sopenharmony_ci * fractional seconds sub-pattern is longer than SSS, the additional 5297777dab0Sopenharmony_ci * display places will be filled with zeros. 5307777dab0Sopenharmony_ci * @stable ICU 3.0 5317777dab0Sopenharmony_ci */ 5327777dab0Sopenharmony_ci UDAT_FRACTIONAL_SECOND_FIELD = 8, 5337777dab0Sopenharmony_ci 5347777dab0Sopenharmony_ci /** 5357777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'E' field alignment, 5367777dab0Sopenharmony_ci * corresponding to the UCAL_DAY_OF_WEEK field. 5377777dab0Sopenharmony_ci * @stable ICU 3.0 5387777dab0Sopenharmony_ci */ 5397777dab0Sopenharmony_ci UDAT_DAY_OF_WEEK_FIELD = 9, 5407777dab0Sopenharmony_ci 5417777dab0Sopenharmony_ci /** 5427777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'D' field alignment, 5437777dab0Sopenharmony_ci * corresponding to the UCAL_DAY_OF_YEAR field. 5447777dab0Sopenharmony_ci * @stable ICU 3.0 5457777dab0Sopenharmony_ci */ 5467777dab0Sopenharmony_ci UDAT_DAY_OF_YEAR_FIELD = 10, 5477777dab0Sopenharmony_ci 5487777dab0Sopenharmony_ci /** 5497777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'F' field alignment, 5507777dab0Sopenharmony_ci * corresponding to the UCAL_DAY_OF_WEEK_IN_MONTH field. 5517777dab0Sopenharmony_ci * @stable ICU 3.0 5527777dab0Sopenharmony_ci */ 5537777dab0Sopenharmony_ci UDAT_DAY_OF_WEEK_IN_MONTH_FIELD = 11, 5547777dab0Sopenharmony_ci 5557777dab0Sopenharmony_ci /** 5567777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'w' field alignment, 5577777dab0Sopenharmony_ci * corresponding to the UCAL_WEEK_OF_YEAR field. 5587777dab0Sopenharmony_ci * @stable ICU 3.0 5597777dab0Sopenharmony_ci */ 5607777dab0Sopenharmony_ci UDAT_WEEK_OF_YEAR_FIELD = 12, 5617777dab0Sopenharmony_ci 5627777dab0Sopenharmony_ci /** 5637777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'W' field alignment, 5647777dab0Sopenharmony_ci * corresponding to the UCAL_WEEK_OF_MONTH field. 5657777dab0Sopenharmony_ci * @stable ICU 3.0 5667777dab0Sopenharmony_ci */ 5677777dab0Sopenharmony_ci UDAT_WEEK_OF_MONTH_FIELD = 13, 5687777dab0Sopenharmony_ci 5697777dab0Sopenharmony_ci /** 5707777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'a' field alignment, 5717777dab0Sopenharmony_ci * corresponding to the UCAL_AM_PM field. 5727777dab0Sopenharmony_ci * @stable ICU 3.0 5737777dab0Sopenharmony_ci */ 5747777dab0Sopenharmony_ci UDAT_AM_PM_FIELD = 14, 5757777dab0Sopenharmony_ci 5767777dab0Sopenharmony_ci /** 5777777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'h' field alignment, 5787777dab0Sopenharmony_ci * corresponding to the UCAL_HOUR field. 5797777dab0Sopenharmony_ci * UDAT_HOUR1_FIELD is used for the one-based 12-hour clock. 5807777dab0Sopenharmony_ci * For example, 11:30 PM + 1 hour results in 12:30 AM. 5817777dab0Sopenharmony_ci * @stable ICU 3.0 5827777dab0Sopenharmony_ci */ 5837777dab0Sopenharmony_ci UDAT_HOUR1_FIELD = 15, 5847777dab0Sopenharmony_ci 5857777dab0Sopenharmony_ci /** 5867777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'K' field alignment, 5877777dab0Sopenharmony_ci * corresponding to the UCAL_HOUR field. 5887777dab0Sopenharmony_ci * UDAT_HOUR0_FIELD is used for the zero-based 12-hour clock. 5897777dab0Sopenharmony_ci * For example, 11:30 PM + 1 hour results in 00:30 AM. 5907777dab0Sopenharmony_ci * @stable ICU 3.0 5917777dab0Sopenharmony_ci */ 5927777dab0Sopenharmony_ci UDAT_HOUR0_FIELD = 16, 5937777dab0Sopenharmony_ci 5947777dab0Sopenharmony_ci /** 5957777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'z' field alignment, 5967777dab0Sopenharmony_ci * corresponding to the UCAL_ZONE_OFFSET and 5977777dab0Sopenharmony_ci * UCAL_DST_OFFSET fields. 5987777dab0Sopenharmony_ci * @stable ICU 3.0 5997777dab0Sopenharmony_ci */ 6007777dab0Sopenharmony_ci UDAT_TIMEZONE_FIELD = 17, 6017777dab0Sopenharmony_ci 6027777dab0Sopenharmony_ci /** 6037777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'Y' field alignment, 6047777dab0Sopenharmony_ci * corresponding to the UCAL_YEAR_WOY field. 6057777dab0Sopenharmony_ci * @stable ICU 3.0 6067777dab0Sopenharmony_ci */ 6077777dab0Sopenharmony_ci UDAT_YEAR_WOY_FIELD = 18, 6087777dab0Sopenharmony_ci 6097777dab0Sopenharmony_ci /** 6107777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'e' field alignment, 6117777dab0Sopenharmony_ci * corresponding to the UCAL_DOW_LOCAL field. 6127777dab0Sopenharmony_ci * @stable ICU 3.0 6137777dab0Sopenharmony_ci */ 6147777dab0Sopenharmony_ci UDAT_DOW_LOCAL_FIELD = 19, 6157777dab0Sopenharmony_ci 6167777dab0Sopenharmony_ci /** 6177777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'u' field alignment, 6187777dab0Sopenharmony_ci * corresponding to the UCAL_EXTENDED_YEAR field. 6197777dab0Sopenharmony_ci * @stable ICU 3.0 6207777dab0Sopenharmony_ci */ 6217777dab0Sopenharmony_ci UDAT_EXTENDED_YEAR_FIELD = 20, 6227777dab0Sopenharmony_ci 6237777dab0Sopenharmony_ci /** 6247777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'g' field alignment, 6257777dab0Sopenharmony_ci * corresponding to the UCAL_JULIAN_DAY field. 6267777dab0Sopenharmony_ci * @stable ICU 3.0 6277777dab0Sopenharmony_ci */ 6287777dab0Sopenharmony_ci UDAT_JULIAN_DAY_FIELD = 21, 6297777dab0Sopenharmony_ci 6307777dab0Sopenharmony_ci /** 6317777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'A' field alignment, 6327777dab0Sopenharmony_ci * corresponding to the UCAL_MILLISECONDS_IN_DAY field. 6337777dab0Sopenharmony_ci * @stable ICU 3.0 6347777dab0Sopenharmony_ci */ 6357777dab0Sopenharmony_ci UDAT_MILLISECONDS_IN_DAY_FIELD = 22, 6367777dab0Sopenharmony_ci 6377777dab0Sopenharmony_ci /** 6387777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'Z' field alignment, 6397777dab0Sopenharmony_ci * corresponding to the UCAL_ZONE_OFFSET and 6407777dab0Sopenharmony_ci * UCAL_DST_OFFSET fields. 6417777dab0Sopenharmony_ci * @stable ICU 3.0 6427777dab0Sopenharmony_ci */ 6437777dab0Sopenharmony_ci UDAT_TIMEZONE_RFC_FIELD = 23, 6447777dab0Sopenharmony_ci 6457777dab0Sopenharmony_ci /** 6467777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'v' field alignment, 6477777dab0Sopenharmony_ci * corresponding to the UCAL_ZONE_OFFSET field. 6487777dab0Sopenharmony_ci * @stable ICU 3.4 6497777dab0Sopenharmony_ci */ 6507777dab0Sopenharmony_ci UDAT_TIMEZONE_GENERIC_FIELD = 24, 6517777dab0Sopenharmony_ci /** 6527777dab0Sopenharmony_ci * FieldPosition selector for 'c' field alignment, 6537777dab0Sopenharmony_ci * corresponding to the {@link #UCAL_DOW_LOCAL} field. 6547777dab0Sopenharmony_ci * This displays the stand alone day name, if available. 6557777dab0Sopenharmony_ci * @stable ICU 3.4 6567777dab0Sopenharmony_ci */ 6577777dab0Sopenharmony_ci UDAT_STANDALONE_DAY_FIELD = 25, 6587777dab0Sopenharmony_ci 6597777dab0Sopenharmony_ci /** 6607777dab0Sopenharmony_ci * FieldPosition selector for 'L' field alignment, 6617777dab0Sopenharmony_ci * corresponding to the {@link #UCAL_MONTH} field. 6627777dab0Sopenharmony_ci * This displays the stand alone month name, if available. 6637777dab0Sopenharmony_ci * @stable ICU 3.4 6647777dab0Sopenharmony_ci */ 6657777dab0Sopenharmony_ci UDAT_STANDALONE_MONTH_FIELD = 26, 6667777dab0Sopenharmony_ci 6677777dab0Sopenharmony_ci /** 6687777dab0Sopenharmony_ci * FieldPosition selector for "Q" field alignment, 6697777dab0Sopenharmony_ci * corresponding to quarters. This is implemented 6707777dab0Sopenharmony_ci * using the {@link #UCAL_MONTH} field. This 6717777dab0Sopenharmony_ci * displays the quarter. 6727777dab0Sopenharmony_ci * @stable ICU 3.6 6737777dab0Sopenharmony_ci */ 6747777dab0Sopenharmony_ci UDAT_QUARTER_FIELD = 27, 6757777dab0Sopenharmony_ci 6767777dab0Sopenharmony_ci /** 6777777dab0Sopenharmony_ci * FieldPosition selector for the "q" field alignment, 6787777dab0Sopenharmony_ci * corresponding to stand-alone quarters. This is 6797777dab0Sopenharmony_ci * implemented using the {@link #UCAL_MONTH} field. 6807777dab0Sopenharmony_ci * This displays the stand-alone quarter. 6817777dab0Sopenharmony_ci * @stable ICU 3.6 6827777dab0Sopenharmony_ci */ 6837777dab0Sopenharmony_ci UDAT_STANDALONE_QUARTER_FIELD = 28, 6847777dab0Sopenharmony_ci 6857777dab0Sopenharmony_ci /** 6867777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'V' field alignment, 6877777dab0Sopenharmony_ci * corresponding to the UCAL_ZONE_OFFSET field. 6887777dab0Sopenharmony_ci * @stable ICU 3.8 6897777dab0Sopenharmony_ci */ 6907777dab0Sopenharmony_ci UDAT_TIMEZONE_SPECIAL_FIELD = 29, 6917777dab0Sopenharmony_ci 6927777dab0Sopenharmony_ci /** 6937777dab0Sopenharmony_ci * FieldPosition selector for "U" field alignment, 6947777dab0Sopenharmony_ci * corresponding to cyclic year names. This is implemented 6957777dab0Sopenharmony_ci * using the {@link #UCAL_YEAR} field. This displays 6967777dab0Sopenharmony_ci * the cyclic year name, if available. 6977777dab0Sopenharmony_ci * @stable ICU 49 6987777dab0Sopenharmony_ci */ 6997777dab0Sopenharmony_ci UDAT_YEAR_NAME_FIELD = 30, 7007777dab0Sopenharmony_ci 7017777dab0Sopenharmony_ci /** 7027777dab0Sopenharmony_ci * FieldPosition selector for 'O' field alignment, 7037777dab0Sopenharmony_ci * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields. 7047777dab0Sopenharmony_ci * This displays the localized GMT format. 7057777dab0Sopenharmony_ci * @stable ICU 51 7067777dab0Sopenharmony_ci */ 7077777dab0Sopenharmony_ci UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD = 31, 7087777dab0Sopenharmony_ci 7097777dab0Sopenharmony_ci /** 7107777dab0Sopenharmony_ci * FieldPosition selector for 'X' field alignment, 7117777dab0Sopenharmony_ci * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields. 7127777dab0Sopenharmony_ci * This displays the ISO 8601 local time offset format or UTC indicator ("Z"). 7137777dab0Sopenharmony_ci * @stable ICU 51 7147777dab0Sopenharmony_ci */ 7157777dab0Sopenharmony_ci UDAT_TIMEZONE_ISO_FIELD = 32, 7167777dab0Sopenharmony_ci 7177777dab0Sopenharmony_ci /** 7187777dab0Sopenharmony_ci * FieldPosition selector for 'x' field alignment, 7197777dab0Sopenharmony_ci * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSET fields. 7207777dab0Sopenharmony_ci * This displays the ISO 8601 local time offset format. 7217777dab0Sopenharmony_ci * @stable ICU 51 7227777dab0Sopenharmony_ci */ 7237777dab0Sopenharmony_ci UDAT_TIMEZONE_ISO_LOCAL_FIELD = 33, 7247777dab0Sopenharmony_ci 7257777dab0Sopenharmony_ci#ifndef U_HIDE_INTERNAL_API 7267777dab0Sopenharmony_ci /** 7277777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selector for 'r' field alignment, 7287777dab0Sopenharmony_ci * no directly corresponding UCAL_ field. 7297777dab0Sopenharmony_ci * @internal ICU 53 7307777dab0Sopenharmony_ci */ 7317777dab0Sopenharmony_ci UDAT_RELATED_YEAR_FIELD = 34, 7327777dab0Sopenharmony_ci#endif /* U_HIDE_INTERNAL_API */ 7337777dab0Sopenharmony_ci 7347777dab0Sopenharmony_ci /** 7357777dab0Sopenharmony_ci * FieldPosition selector for 'b' field alignment. 7367777dab0Sopenharmony_ci * Displays midnight and noon for 12am and 12pm, respectively, if available; 7377777dab0Sopenharmony_ci * otherwise fall back to AM / PM. 7387777dab0Sopenharmony_ci * @stable ICU 57 7397777dab0Sopenharmony_ci */ 7407777dab0Sopenharmony_ci UDAT_AM_PM_MIDNIGHT_NOON_FIELD = 35, 7417777dab0Sopenharmony_ci 7427777dab0Sopenharmony_ci /* FieldPosition selector for 'B' field alignment. 7437777dab0Sopenharmony_ci * Displays flexible day periods, such as "in the morning", if available. 7447777dab0Sopenharmony_ci * @stable ICU 57 7457777dab0Sopenharmony_ci */ 7467777dab0Sopenharmony_ci UDAT_FLEXIBLE_DAY_PERIOD_FIELD = 36, 7477777dab0Sopenharmony_ci} UDateFormatField; 7487777dab0Sopenharmony_ci 7497777dab0Sopenharmony_ci 7507777dab0Sopenharmony_ci#ifndef U_HIDE_INTERNAL_API 7517777dab0Sopenharmony_ci/** 7527777dab0Sopenharmony_ci * Is a pattern character defined for UDAT_TIME_SEPARATOR_FIELD? 7537777dab0Sopenharmony_ci * In ICU 55 it was COLON, but that was withdrawn in ICU 56. 7547777dab0Sopenharmony_ci * @internal ICU 56 7557777dab0Sopenharmony_ci */ 7567777dab0Sopenharmony_ci#define UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR 0 7577777dab0Sopenharmony_ci#endif /* U_HIDE_INTERNAL_API */ 7587777dab0Sopenharmony_ci 7597777dab0Sopenharmony_ci 7607777dab0Sopenharmony_ci/** 7617777dab0Sopenharmony_ci * Maps from a UDateFormatField to the corresponding UCalendarDateFields. 7627777dab0Sopenharmony_ci * 7637777dab0Sopenharmony_ci * Note 1: Since the mapping is many-to-one, there is no inverse mapping. 7647777dab0Sopenharmony_ci * 7657777dab0Sopenharmony_ci * Note 2: There is no UErrorCode parameter, so in case of error (UDateFormatField is 7667777dab0Sopenharmony_ci * unknown or has no corresponding UCalendarDateFields value), the function returns the 7677777dab0Sopenharmony_ci * current value of UCAL_FIELD_COUNT. However, that value may change from release to 7687777dab0Sopenharmony_ci * release and is consequently deprecated. For a future-proof runtime way of checking 7697777dab0Sopenharmony_ci * for errors: 7707777dab0Sopenharmony_ci * a) First save the value returned by the function when it is passed an invalid value 7717777dab0Sopenharmony_ci * such as "(UDateFormatField)-1". 7727777dab0Sopenharmony_ci * b) Then, to test for errors when passing some other UDateFormatField value, check 7737777dab0Sopenharmony_ci * whether the function returns that saved value. 7747777dab0Sopenharmony_ci * 7757777dab0Sopenharmony_ci * @param field the UDateFormatField. 7767777dab0Sopenharmony_ci * @return the UCalendarDateField. In case of error (UDateFormatField is unknown or has 7777777dab0Sopenharmony_ci * no corresponding UCalendarDateFields value) this will be the current value of 7787777dab0Sopenharmony_ci * UCAL_FIELD_COUNT, but that value may change from release to release. 7797777dab0Sopenharmony_ci * See Note 2 above. 7807777dab0Sopenharmony_ci * @stable ICU 4.4 7817777dab0Sopenharmony_ci */ 7827777dab0Sopenharmony_ciU_CAPI UCalendarDateFields U_EXPORT2 7837777dab0Sopenharmony_ciudat_toCalendarDateField(UDateFormatField field); 7847777dab0Sopenharmony_ci 7857777dab0Sopenharmony_ci 7867777dab0Sopenharmony_ci/** 7877777dab0Sopenharmony_ci * Open a new UDateFormat for formatting and parsing dates and times. 7887777dab0Sopenharmony_ci * A UDateFormat may be used to format dates in calls to {@link #udat_format }, 7897777dab0Sopenharmony_ci * and to parse dates in calls to {@link #udat_parse }. 7907777dab0Sopenharmony_ci * @param timeStyle The style used to format times; one of UDAT_FULL, UDAT_LONG, 7917777dab0Sopenharmony_ci * UDAT_MEDIUM, UDAT_SHORT, UDAT_DEFAULT, or UDAT_NONE (relative time styles 7927777dab0Sopenharmony_ci * are not currently supported). 7937777dab0Sopenharmony_ci * When the pattern parameter is used, pass in UDAT_PATTERN for both timeStyle and dateStyle. 7947777dab0Sopenharmony_ci * @param dateStyle The style used to format dates; one of UDAT_FULL, UDAT_LONG, 7957777dab0Sopenharmony_ci * UDAT_MEDIUM, UDAT_SHORT, UDAT_DEFAULT, UDAT_FULL_RELATIVE, UDAT_LONG_RELATIVE, 7967777dab0Sopenharmony_ci * UDAT_MEDIUM_RELATIVE, UDAT_SHORT_RELATIVE, or UDAT_NONE. 7977777dab0Sopenharmony_ci * When the pattern parameter is used, pass in UDAT_PATTERN for both timeStyle and dateStyle. 7987777dab0Sopenharmony_ci * As currently implemented, 7997777dab0Sopenharmony_ci * relative date formatting only affects a limited range of calendar days before or 8007777dab0Sopenharmony_ci * after the current date, based on the CLDR <field type="day">/<relative> data: For 8017777dab0Sopenharmony_ci * example, in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, 8027777dab0Sopenharmony_ci * dates are formatted using the corresponding non-relative style. 8037777dab0Sopenharmony_ci * @param locale The locale specifying the formatting conventions 8047777dab0Sopenharmony_ci * @param tzID A timezone ID specifying the timezone to use. If 0, use 8057777dab0Sopenharmony_ci * the default timezone. 8067777dab0Sopenharmony_ci * @param tzIDLength The length of tzID, or -1 if null-terminated. 8077777dab0Sopenharmony_ci * @param pattern A pattern specifying the format to use. 8087777dab0Sopenharmony_ci * @param patternLength The number of characters in the pattern, or -1 if null-terminated. 8097777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors 8107777dab0Sopenharmony_ci * @return A pointer to a UDateFormat to use for formatting dates and times, or 0 if 8117777dab0Sopenharmony_ci * an error occurred. 8127777dab0Sopenharmony_ci * @stable ICU 2.0 8137777dab0Sopenharmony_ci */ 8147777dab0Sopenharmony_ciU_CAPI UDateFormat* U_EXPORT2 8157777dab0Sopenharmony_ciudat_open(UDateFormatStyle timeStyle, 8167777dab0Sopenharmony_ci UDateFormatStyle dateStyle, 8177777dab0Sopenharmony_ci const char *locale, 8187777dab0Sopenharmony_ci const UChar *tzID, 8197777dab0Sopenharmony_ci int32_t tzIDLength, 8207777dab0Sopenharmony_ci const UChar *pattern, 8217777dab0Sopenharmony_ci int32_t patternLength, 8227777dab0Sopenharmony_ci UErrorCode *status); 8237777dab0Sopenharmony_ci 8247777dab0Sopenharmony_ci 8257777dab0Sopenharmony_ci/** 8267777dab0Sopenharmony_ci* Close a UDateFormat. 8277777dab0Sopenharmony_ci* Once closed, a UDateFormat may no longer be used. 8287777dab0Sopenharmony_ci* @param format The formatter to close. 8297777dab0Sopenharmony_ci* @stable ICU 2.0 8307777dab0Sopenharmony_ci*/ 8317777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 8327777dab0Sopenharmony_ciudat_close(UDateFormat* format); 8337777dab0Sopenharmony_ci 8347777dab0Sopenharmony_ci 8357777dab0Sopenharmony_ci/** 8367777dab0Sopenharmony_ci * DateFormat boolean attributes 8377777dab0Sopenharmony_ci * 8387777dab0Sopenharmony_ci * @stable ICU 53 8397777dab0Sopenharmony_ci */ 8407777dab0Sopenharmony_citypedef enum UDateFormatBooleanAttribute { 8417777dab0Sopenharmony_ci /** 8427777dab0Sopenharmony_ci * indicates whether whitespace is allowed. Includes trailing dot tolerance. 8437777dab0Sopenharmony_ci * @stable ICU 53 8447777dab0Sopenharmony_ci */ 8457777dab0Sopenharmony_ci UDAT_PARSE_ALLOW_WHITESPACE = 0, 8467777dab0Sopenharmony_ci /** 8477777dab0Sopenharmony_ci * indicates tolerance of numeric data when String data may be assumed. eg: UDAT_YEAR_NAME_FIELD, 8487777dab0Sopenharmony_ci * UDAT_STANDALONE_MONTH_FIELD, UDAT_DAY_OF_WEEK_FIELD 8497777dab0Sopenharmony_ci * @stable ICU 53 8507777dab0Sopenharmony_ci */ 8517777dab0Sopenharmony_ci UDAT_PARSE_ALLOW_NUMERIC = 1, 8527777dab0Sopenharmony_ci /** 8537777dab0Sopenharmony_ci * indicates tolerance of a partial literal match 8547777dab0Sopenharmony_ci * e.g. accepting "--mon-02-march-2011" for a pattern of "'--: 'EEE-WW-MMMM-yyyy" 8557777dab0Sopenharmony_ci * @stable ICU 56 8567777dab0Sopenharmony_ci */ 8577777dab0Sopenharmony_ci UDAT_PARSE_PARTIAL_LITERAL_MATCH = 2, 8587777dab0Sopenharmony_ci /** 8597777dab0Sopenharmony_ci * indicates tolerance of pattern mismatch between input data and specified format pattern. 8607777dab0Sopenharmony_ci * e.g. accepting "September" for a month pattern of MMM ("Sep") 8617777dab0Sopenharmony_ci * @stable ICU 56 8627777dab0Sopenharmony_ci */ 8637777dab0Sopenharmony_ci UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH = 3, 8647777dab0Sopenharmony_ci} UDateFormatBooleanAttribute; 8657777dab0Sopenharmony_ci 8667777dab0Sopenharmony_ci/** 8677777dab0Sopenharmony_ci * Get a boolean attribute associated with a UDateFormat. 8687777dab0Sopenharmony_ci * An example would be a true value for a key of UDAT_PARSE_ALLOW_WHITESPACE indicating allowing whitespace leniency. 8697777dab0Sopenharmony_ci * If the formatter does not understand the attribute, -1 is returned. 8707777dab0Sopenharmony_ci * @param fmt The formatter to query. 8717777dab0Sopenharmony_ci * @param attr The attribute to query; e.g. UDAT_PARSE_ALLOW_WHITESPACE. 8727777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors 8737777dab0Sopenharmony_ci * @return The value of attr. 8747777dab0Sopenharmony_ci * @stable ICU 53 8757777dab0Sopenharmony_ci */ 8767777dab0Sopenharmony_ciU_CAPI UBool U_EXPORT2 8777777dab0Sopenharmony_ciudat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute attr, UErrorCode* status); 8787777dab0Sopenharmony_ci 8797777dab0Sopenharmony_ci/** 8807777dab0Sopenharmony_ci * Set a boolean attribute associated with a UDateFormat. 8817777dab0Sopenharmony_ci * An example of a boolean attribute is parse leniency control. If the formatter does not understand 8827777dab0Sopenharmony_ci * the attribute, the call is ignored. 8837777dab0Sopenharmony_ci * @param fmt The formatter to set. 8847777dab0Sopenharmony_ci * @param attr The attribute to set; one of UDAT_PARSE_ALLOW_WHITESPACE or UDAT_PARSE_ALLOW_NUMERIC 8857777dab0Sopenharmony_ci * @param newValue The new value of attr. 8867777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors 8877777dab0Sopenharmony_ci * @stable ICU 53 8887777dab0Sopenharmony_ci */ 8897777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 8907777dab0Sopenharmony_ciudat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBool newValue, UErrorCode* status); 8917777dab0Sopenharmony_ci 8927777dab0Sopenharmony_ci/** 8937777dab0Sopenharmony_ci * Hour Cycle. 8947777dab0Sopenharmony_ci * @stable ICU 67 8957777dab0Sopenharmony_ci */ 8967777dab0Sopenharmony_citypedef enum UDateFormatHourCycle { 8977777dab0Sopenharmony_ci /** 8987777dab0Sopenharmony_ci * Hour in am/pm (0~11) 8997777dab0Sopenharmony_ci * @stable ICU 67 9007777dab0Sopenharmony_ci */ 9017777dab0Sopenharmony_ci UDAT_HOUR_CYCLE_11, 9027777dab0Sopenharmony_ci 9037777dab0Sopenharmony_ci /** 9047777dab0Sopenharmony_ci * Hour in am/pm (1~12) 9057777dab0Sopenharmony_ci * @stable ICU 67 9067777dab0Sopenharmony_ci */ 9077777dab0Sopenharmony_ci UDAT_HOUR_CYCLE_12, 9087777dab0Sopenharmony_ci 9097777dab0Sopenharmony_ci /** 9107777dab0Sopenharmony_ci * Hour in day (0~23) 9117777dab0Sopenharmony_ci * @stable ICU 67 9127777dab0Sopenharmony_ci */ 9137777dab0Sopenharmony_ci UDAT_HOUR_CYCLE_23, 9147777dab0Sopenharmony_ci 9157777dab0Sopenharmony_ci /** 9167777dab0Sopenharmony_ci * Hour in day (1~24) 9177777dab0Sopenharmony_ci * @stable ICU 67 9187777dab0Sopenharmony_ci */ 9197777dab0Sopenharmony_ci UDAT_HOUR_CYCLE_24 9207777dab0Sopenharmony_ci} UDateFormatHourCycle; 9217777dab0Sopenharmony_ci 9227777dab0Sopenharmony_ci#if U_SHOW_CPLUSPLUS_API 9237777dab0Sopenharmony_ci 9247777dab0Sopenharmony_ciU_NAMESPACE_BEGIN 9257777dab0Sopenharmony_ci 9267777dab0Sopenharmony_ci/** 9277777dab0Sopenharmony_ci * \class LocalUDateFormatPointer 9287777dab0Sopenharmony_ci * "Smart pointer" class, closes a UDateFormat via udat_close(). 9297777dab0Sopenharmony_ci * For most methods see the LocalPointerBase base class. 9307777dab0Sopenharmony_ci * 9317777dab0Sopenharmony_ci * @see LocalPointerBase 9327777dab0Sopenharmony_ci * @see LocalPointer 9337777dab0Sopenharmony_ci * @stable ICU 4.4 9347777dab0Sopenharmony_ci */ 9357777dab0Sopenharmony_ciU_DEFINE_LOCAL_OPEN_POINTER(LocalUDateFormatPointer, UDateFormat, udat_close); 9367777dab0Sopenharmony_ci 9377777dab0Sopenharmony_ciU_NAMESPACE_END 9387777dab0Sopenharmony_ci 9397777dab0Sopenharmony_ci#endif 9407777dab0Sopenharmony_ci 9417777dab0Sopenharmony_ci/** 9427777dab0Sopenharmony_ci * Open a copy of a UDateFormat. 9437777dab0Sopenharmony_ci * This function performs a deep copy. 9447777dab0Sopenharmony_ci * @param fmt The format to copy 9457777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors. 9467777dab0Sopenharmony_ci * @return A pointer to a UDateFormat identical to fmt. 9477777dab0Sopenharmony_ci * @stable ICU 2.0 9487777dab0Sopenharmony_ci */ 9497777dab0Sopenharmony_ciU_CAPI UDateFormat* U_EXPORT2 9507777dab0Sopenharmony_ciudat_clone(const UDateFormat *fmt, 9517777dab0Sopenharmony_ci UErrorCode *status); 9527777dab0Sopenharmony_ci 9537777dab0Sopenharmony_ci/** 9547777dab0Sopenharmony_ci* Format a date using a UDateFormat. 9557777dab0Sopenharmony_ci* The date will be formatted using the conventions specified in {@link #udat_open } 9567777dab0Sopenharmony_ci* @param format The formatter to use 9577777dab0Sopenharmony_ci* @param dateToFormat The date to format 9587777dab0Sopenharmony_ci* @param result A pointer to a buffer to receive the formatted number. 9597777dab0Sopenharmony_ci* @param resultLength The maximum size of result. 9607777dab0Sopenharmony_ci* @param position A pointer to a UFieldPosition. On input, position->field 9617777dab0Sopenharmony_ci* is read. On output, position->beginIndex and position->endIndex indicate 9627777dab0Sopenharmony_ci* the beginning and ending indices of field number position->field, if such 9637777dab0Sopenharmony_ci* a field exists. This parameter may be NULL, in which case no field 9647777dab0Sopenharmony_ci* position data is returned. 9657777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors 9667777dab0Sopenharmony_ci* @return The total buffer size needed; if greater than resultLength, the output was truncated. 9677777dab0Sopenharmony_ci* @see udat_parse 9687777dab0Sopenharmony_ci* @see UFieldPosition 9697777dab0Sopenharmony_ci* @stable ICU 2.0 9707777dab0Sopenharmony_ci*/ 9717777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 9727777dab0Sopenharmony_ciudat_format( const UDateFormat* format, 9737777dab0Sopenharmony_ci UDate dateToFormat, 9747777dab0Sopenharmony_ci UChar* result, 9757777dab0Sopenharmony_ci int32_t resultLength, 9767777dab0Sopenharmony_ci UFieldPosition* position, 9777777dab0Sopenharmony_ci UErrorCode* status); 9787777dab0Sopenharmony_ci 9797777dab0Sopenharmony_ci/** 9807777dab0Sopenharmony_ci* Format a date using an UDateFormat. 9817777dab0Sopenharmony_ci* The date will be formatted using the conventions specified in {@link #udat_open } 9827777dab0Sopenharmony_ci* @param format The formatter to use 9837777dab0Sopenharmony_ci* @param calendar The calendar to format. The calendar instance might be 9847777dab0Sopenharmony_ci* mutated if fields are not yet fully calculated, though 9857777dab0Sopenharmony_ci* the function won't change the logical date and time held 9867777dab0Sopenharmony_ci* by the instance. 9877777dab0Sopenharmony_ci* @param result A pointer to a buffer to receive the formatted number. 9887777dab0Sopenharmony_ci* @param capacity The maximum size of result. 9897777dab0Sopenharmony_ci* @param position A pointer to a UFieldPosition. On input, position->field 9907777dab0Sopenharmony_ci* is read. On output, position->beginIndex and position->endIndex indicate 9917777dab0Sopenharmony_ci* the beginning and ending indices of field number position->field, if such 9927777dab0Sopenharmony_ci* a field exists. This parameter may be NULL, in which case no field 9937777dab0Sopenharmony_ci* position data is returned. 9947777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors 9957777dab0Sopenharmony_ci* @return The total buffer size needed; if greater than resultLength, the output was truncated. 9967777dab0Sopenharmony_ci* @see udat_format 9977777dab0Sopenharmony_ci* @see udat_parseCalendar 9987777dab0Sopenharmony_ci* @see UFieldPosition 9997777dab0Sopenharmony_ci* @stable ICU 55 10007777dab0Sopenharmony_ci*/ 10017777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 10027777dab0Sopenharmony_ciudat_formatCalendar( const UDateFormat* format, 10037777dab0Sopenharmony_ci UCalendar* calendar, 10047777dab0Sopenharmony_ci UChar* result, 10057777dab0Sopenharmony_ci int32_t capacity, 10067777dab0Sopenharmony_ci UFieldPosition* position, 10077777dab0Sopenharmony_ci UErrorCode* status); 10087777dab0Sopenharmony_ci 10097777dab0Sopenharmony_ci/** 10107777dab0Sopenharmony_ci* Format a date using a UDateFormat. 10117777dab0Sopenharmony_ci* The date will be formatted using the conventions specified in {@link #udat_open} 10127777dab0Sopenharmony_ci* @param format 10137777dab0Sopenharmony_ci* The formatter to use 10147777dab0Sopenharmony_ci* @param dateToFormat 10157777dab0Sopenharmony_ci* The date to format 10167777dab0Sopenharmony_ci* @param result 10177777dab0Sopenharmony_ci* A pointer to a buffer to receive the formatted number. 10187777dab0Sopenharmony_ci* @param resultLength 10197777dab0Sopenharmony_ci* The maximum size of result. 10207777dab0Sopenharmony_ci* @param fpositer 10217777dab0Sopenharmony_ci* A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open} 10227777dab0Sopenharmony_ci* (may be NULL if field position information is not needed). Any 10237777dab0Sopenharmony_ci* iteration information already present in the UFieldPositionIterator 10247777dab0Sopenharmony_ci* will be deleted, and the iterator will be reset to apply to the 10257777dab0Sopenharmony_ci* fields in the formatted string created by this function call; the 10267777dab0Sopenharmony_ci* field values provided by {@link #ufieldpositer_next} will be from the 10277777dab0Sopenharmony_ci* UDateFormatField enum. 10287777dab0Sopenharmony_ci* @param status 10297777dab0Sopenharmony_ci* A pointer to a UErrorCode to receive any errors 10307777dab0Sopenharmony_ci* @return 10317777dab0Sopenharmony_ci* The total buffer size needed; if greater than resultLength, the output was truncated. 10327777dab0Sopenharmony_ci* @see udat_parse 10337777dab0Sopenharmony_ci* @see UFieldPositionIterator 10347777dab0Sopenharmony_ci* @stable ICU 55 10357777dab0Sopenharmony_ci*/ 10367777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 10377777dab0Sopenharmony_ciudat_formatForFields( const UDateFormat* format, 10387777dab0Sopenharmony_ci UDate dateToFormat, 10397777dab0Sopenharmony_ci UChar* result, 10407777dab0Sopenharmony_ci int32_t resultLength, 10417777dab0Sopenharmony_ci UFieldPositionIterator* fpositer, 10427777dab0Sopenharmony_ci UErrorCode* status); 10437777dab0Sopenharmony_ci 10447777dab0Sopenharmony_ci/** 10457777dab0Sopenharmony_ci* Format a date using a UDateFormat. 10467777dab0Sopenharmony_ci* The date will be formatted using the conventions specified in {@link #udat_open } 10477777dab0Sopenharmony_ci* @param format 10487777dab0Sopenharmony_ci* The formatter to use 10497777dab0Sopenharmony_ci* @param calendar 10507777dab0Sopenharmony_ci* The calendar to format. The calendar instance might be mutated if fields 10517777dab0Sopenharmony_ci* are not yet fully calculated, though the function won't change the logical 10527777dab0Sopenharmony_ci* date and time held by the instance. 10537777dab0Sopenharmony_ci* @param result 10547777dab0Sopenharmony_ci* A pointer to a buffer to receive the formatted number. 10557777dab0Sopenharmony_ci* @param capacity 10567777dab0Sopenharmony_ci* The maximum size of result. 10577777dab0Sopenharmony_ci* @param fpositer 10587777dab0Sopenharmony_ci* A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open} 10597777dab0Sopenharmony_ci* (may be NULL if field position information is not needed). Any 10607777dab0Sopenharmony_ci* iteration information already present in the UFieldPositionIterator 10617777dab0Sopenharmony_ci* will be deleted, and the iterator will be reset to apply to the 10627777dab0Sopenharmony_ci* fields in the formatted string created by this function call; the 10637777dab0Sopenharmony_ci* field values provided by {@link #ufieldpositer_next} will be from the 10647777dab0Sopenharmony_ci* UDateFormatField enum. 10657777dab0Sopenharmony_ci* @param status 10667777dab0Sopenharmony_ci* A pointer to a UErrorCode to receive any errors 10677777dab0Sopenharmony_ci* @return 10687777dab0Sopenharmony_ci* The total buffer size needed; if greater than resultLength, the output was truncated. 10697777dab0Sopenharmony_ci* @see udat_format 10707777dab0Sopenharmony_ci* @see udat_parseCalendar 10717777dab0Sopenharmony_ci* @see UFieldPositionIterator 10727777dab0Sopenharmony_ci* @stable ICU 55 10737777dab0Sopenharmony_ci*/ 10747777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 10757777dab0Sopenharmony_ciudat_formatCalendarForFields( const UDateFormat* format, 10767777dab0Sopenharmony_ci UCalendar* calendar, 10777777dab0Sopenharmony_ci UChar* result, 10787777dab0Sopenharmony_ci int32_t capacity, 10797777dab0Sopenharmony_ci UFieldPositionIterator* fpositer, 10807777dab0Sopenharmony_ci UErrorCode* status); 10817777dab0Sopenharmony_ci 10827777dab0Sopenharmony_ci 10837777dab0Sopenharmony_ci/** 10847777dab0Sopenharmony_ci* Parse a string into an date/time using a UDateFormat. 10857777dab0Sopenharmony_ci* The date will be parsed using the conventions specified in {@link #udat_open }. 10867777dab0Sopenharmony_ci* <P> 10877777dab0Sopenharmony_ci* Note that the normal date formats associated with some calendars - such 10887777dab0Sopenharmony_ci* as the Chinese lunar calendar - do not specify enough fields to enable 10897777dab0Sopenharmony_ci* dates to be parsed unambiguously. In the case of the Chinese lunar 10907777dab0Sopenharmony_ci* calendar, while the year within the current 60-year cycle is specified, 10917777dab0Sopenharmony_ci* the number of such cycles since the start date of the calendar (in the 10927777dab0Sopenharmony_ci* UCAL_ERA field of the UCalendar object) is not normally part of the format, 10937777dab0Sopenharmony_ci* and parsing may assume the wrong era. For cases such as this it is 10947777dab0Sopenharmony_ci* recommended that clients parse using udat_parseCalendar with the UCalendar 10957777dab0Sopenharmony_ci* passed in set to the current date, or to a date within the era/cycle that 10967777dab0Sopenharmony_ci* should be assumed if absent in the format. 10977777dab0Sopenharmony_ci* 10987777dab0Sopenharmony_ci* @param format The formatter to use. 10997777dab0Sopenharmony_ci* @param text The text to parse. 11007777dab0Sopenharmony_ci* @param textLength The length of text, or -1 if null-terminated. 11017777dab0Sopenharmony_ci* @param parsePos If not 0, on input a pointer to an integer specifying the offset at which 11027777dab0Sopenharmony_ci* to begin parsing. If not 0, on output the offset at which parsing ended. 11037777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors 11047777dab0Sopenharmony_ci* @return The value of the parsed date/time 11057777dab0Sopenharmony_ci* @see udat_format 11067777dab0Sopenharmony_ci* @stable ICU 2.0 11077777dab0Sopenharmony_ci*/ 11087777dab0Sopenharmony_ciU_CAPI UDate U_EXPORT2 11097777dab0Sopenharmony_ciudat_parse(const UDateFormat* format, 11107777dab0Sopenharmony_ci const UChar* text, 11117777dab0Sopenharmony_ci int32_t textLength, 11127777dab0Sopenharmony_ci int32_t *parsePos, 11137777dab0Sopenharmony_ci UErrorCode *status); 11147777dab0Sopenharmony_ci 11157777dab0Sopenharmony_ci/** 11167777dab0Sopenharmony_ci* Parse a string into an date/time using a UDateFormat. 11177777dab0Sopenharmony_ci* The date will be parsed using the conventions specified in {@link #udat_open }. 11187777dab0Sopenharmony_ci* @param format The formatter to use. 11197777dab0Sopenharmony_ci* @param calendar A calendar set on input to the date and time to be used for 11207777dab0Sopenharmony_ci* missing values in the date/time string being parsed, and set 11217777dab0Sopenharmony_ci* on output to the parsed date/time. When the calendar type is 11227777dab0Sopenharmony_ci* different from the internal calendar held by the UDateFormat 11237777dab0Sopenharmony_ci* instance, the internal calendar will be cloned to a work 11247777dab0Sopenharmony_ci* calendar set to the same milliseconds and time zone as this 11257777dab0Sopenharmony_ci* calendar parameter, field values will be parsed based on the 11267777dab0Sopenharmony_ci* work calendar, then the result (milliseconds and time zone) 11277777dab0Sopenharmony_ci* will be set in this calendar. 11287777dab0Sopenharmony_ci* @param text The text to parse. 11297777dab0Sopenharmony_ci* @param textLength The length of text, or -1 if null-terminated. 11307777dab0Sopenharmony_ci* @param parsePos If not 0, on input a pointer to an integer specifying the offset at which 11317777dab0Sopenharmony_ci* to begin parsing. If not 0, on output the offset at which parsing ended. 11327777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors 11337777dab0Sopenharmony_ci* @see udat_format 11347777dab0Sopenharmony_ci* @stable ICU 2.0 11357777dab0Sopenharmony_ci*/ 11367777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 11377777dab0Sopenharmony_ciudat_parseCalendar(const UDateFormat* format, 11387777dab0Sopenharmony_ci UCalendar* calendar, 11397777dab0Sopenharmony_ci const UChar* text, 11407777dab0Sopenharmony_ci int32_t textLength, 11417777dab0Sopenharmony_ci int32_t *parsePos, 11427777dab0Sopenharmony_ci UErrorCode *status); 11437777dab0Sopenharmony_ci 11447777dab0Sopenharmony_ci/** 11457777dab0Sopenharmony_ci* Determine if an UDateFormat will perform lenient parsing. 11467777dab0Sopenharmony_ci* With lenient parsing, the parser may use heuristics to interpret inputs that do not 11477777dab0Sopenharmony_ci* precisely match the pattern. With strict parsing, inputs must match the pattern. 11487777dab0Sopenharmony_ci* @param fmt The formatter to query 11497777dab0Sopenharmony_ci* @return true if fmt is set to perform lenient parsing, false otherwise. 11507777dab0Sopenharmony_ci* @see udat_setLenient 11517777dab0Sopenharmony_ci* @stable ICU 2.0 11527777dab0Sopenharmony_ci*/ 11537777dab0Sopenharmony_ciU_CAPI UBool U_EXPORT2 11547777dab0Sopenharmony_ciudat_isLenient(const UDateFormat* fmt); 11557777dab0Sopenharmony_ci 11567777dab0Sopenharmony_ci/** 11577777dab0Sopenharmony_ci* Specify whether an UDateFormat will perform lenient parsing. 11587777dab0Sopenharmony_ci* With lenient parsing, the parser may use heuristics to interpret inputs that do not 11597777dab0Sopenharmony_ci* precisely match the pattern. With strict parsing, inputs must match the pattern. 11607777dab0Sopenharmony_ci* @param fmt The formatter to set 11617777dab0Sopenharmony_ci* @param isLenient true if fmt should perform lenient parsing, false otherwise. 11627777dab0Sopenharmony_ci* @see dat_isLenient 11637777dab0Sopenharmony_ci* @stable ICU 2.0 11647777dab0Sopenharmony_ci*/ 11657777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 11667777dab0Sopenharmony_ciudat_setLenient( UDateFormat* fmt, 11677777dab0Sopenharmony_ci UBool isLenient); 11687777dab0Sopenharmony_ci 11697777dab0Sopenharmony_ci/** 11707777dab0Sopenharmony_ci* Get the UCalendar associated with an UDateFormat. 11717777dab0Sopenharmony_ci* A UDateFormat uses a UCalendar to convert a raw value to, for example, 11727777dab0Sopenharmony_ci* the day of the week. 11737777dab0Sopenharmony_ci* @param fmt The formatter to query. 11747777dab0Sopenharmony_ci* @return A pointer to the UCalendar used by fmt. 11757777dab0Sopenharmony_ci* @see udat_setCalendar 11767777dab0Sopenharmony_ci* @stable ICU 2.0 11777777dab0Sopenharmony_ci*/ 11787777dab0Sopenharmony_ciU_CAPI const UCalendar* U_EXPORT2 11797777dab0Sopenharmony_ciudat_getCalendar(const UDateFormat* fmt); 11807777dab0Sopenharmony_ci 11817777dab0Sopenharmony_ci/** 11827777dab0Sopenharmony_ci* Set the UCalendar associated with an UDateFormat. 11837777dab0Sopenharmony_ci* A UDateFormat uses a UCalendar to convert a raw value to, for example, 11847777dab0Sopenharmony_ci* the day of the week. 11857777dab0Sopenharmony_ci* @param fmt The formatter to set. 11867777dab0Sopenharmony_ci* @param calendarToSet A pointer to an UCalendar to be used by fmt. 11877777dab0Sopenharmony_ci* @see udat_setCalendar 11887777dab0Sopenharmony_ci* @stable ICU 2.0 11897777dab0Sopenharmony_ci*/ 11907777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 11917777dab0Sopenharmony_ciudat_setCalendar( UDateFormat* fmt, 11927777dab0Sopenharmony_ci const UCalendar* calendarToSet); 11937777dab0Sopenharmony_ci 11947777dab0Sopenharmony_ci/** 11957777dab0Sopenharmony_ci* Get the UNumberFormat associated with an UDateFormat. 11967777dab0Sopenharmony_ci* A UDateFormat uses a UNumberFormat to format numbers within a date, 11977777dab0Sopenharmony_ci* for example the day number. 11987777dab0Sopenharmony_ci* @param fmt The formatter to query. 11997777dab0Sopenharmony_ci* @return A pointer to the UNumberFormat used by fmt to format numbers. 12007777dab0Sopenharmony_ci* @see udat_setNumberFormat 12017777dab0Sopenharmony_ci* @stable ICU 2.0 12027777dab0Sopenharmony_ci*/ 12037777dab0Sopenharmony_ciU_CAPI const UNumberFormat* U_EXPORT2 12047777dab0Sopenharmony_ciudat_getNumberFormat(const UDateFormat* fmt); 12057777dab0Sopenharmony_ci 12067777dab0Sopenharmony_ci/** 12077777dab0Sopenharmony_ci* Get the UNumberFormat for specific field associated with an UDateFormat. 12087777dab0Sopenharmony_ci* For example: 'y' for year and 'M' for month 12097777dab0Sopenharmony_ci* @param fmt The formatter to query. 12107777dab0Sopenharmony_ci* @param field the field to query 12117777dab0Sopenharmony_ci* @return A pointer to the UNumberFormat used by fmt to format field numbers. 12127777dab0Sopenharmony_ci* @see udat_setNumberFormatForField 12137777dab0Sopenharmony_ci* @stable ICU 54 12147777dab0Sopenharmony_ci*/ 12157777dab0Sopenharmony_ciU_CAPI const UNumberFormat* U_EXPORT2 12167777dab0Sopenharmony_ciudat_getNumberFormatForField(const UDateFormat* fmt, UChar field); 12177777dab0Sopenharmony_ci 12187777dab0Sopenharmony_ci/** 12197777dab0Sopenharmony_ci* Set the UNumberFormat for specific field associated with an UDateFormat. 12207777dab0Sopenharmony_ci* It can be a single field like: "y"(year) or "M"(month) 12217777dab0Sopenharmony_ci* It can be several field combined together: "yM"(year and month) 12227777dab0Sopenharmony_ci* Note: 12237777dab0Sopenharmony_ci* 1 symbol field is enough for multiple symbol field (so "y" will override "yy", "yyy") 12247777dab0Sopenharmony_ci* If the field is not numeric, then override has no effect (like "MMM" will use abbreviation, not numerical field) 12257777dab0Sopenharmony_ci* 12267777dab0Sopenharmony_ci* @param fields the fields to set 12277777dab0Sopenharmony_ci* @param fmt The formatter to set. 12287777dab0Sopenharmony_ci* @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to format numbers. 12297777dab0Sopenharmony_ci* @param status error code passed around (memory allocation or invalid fields) 12307777dab0Sopenharmony_ci* @see udat_getNumberFormatForField 12317777dab0Sopenharmony_ci* @stable ICU 54 12327777dab0Sopenharmony_ci*/ 12337777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 12347777dab0Sopenharmony_ciudat_adoptNumberFormatForFields( UDateFormat* fmt, 12357777dab0Sopenharmony_ci const UChar* fields, 12367777dab0Sopenharmony_ci UNumberFormat* numberFormatToSet, 12377777dab0Sopenharmony_ci UErrorCode* status); 12387777dab0Sopenharmony_ci/** 12397777dab0Sopenharmony_ci* Set the UNumberFormat associated with an UDateFormat. 12407777dab0Sopenharmony_ci* A UDateFormat uses a UNumberFormat to format numbers within a date, 12417777dab0Sopenharmony_ci* for example the day number. 12427777dab0Sopenharmony_ci* This method also clears per field NumberFormat instances previously 12437777dab0Sopenharmony_ci* set by {@see udat_setNumberFormatForField} 12447777dab0Sopenharmony_ci* @param fmt The formatter to set. 12457777dab0Sopenharmony_ci* @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to format numbers. 12467777dab0Sopenharmony_ci* @see udat_getNumberFormat 12477777dab0Sopenharmony_ci* @see udat_setNumberFormatForField 12487777dab0Sopenharmony_ci* @stable ICU 2.0 12497777dab0Sopenharmony_ci*/ 12507777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 12517777dab0Sopenharmony_ciudat_setNumberFormat( UDateFormat* fmt, 12527777dab0Sopenharmony_ci const UNumberFormat* numberFormatToSet); 12537777dab0Sopenharmony_ci/** 12547777dab0Sopenharmony_ci* Adopt the UNumberFormat associated with an UDateFormat. 12557777dab0Sopenharmony_ci* A UDateFormat uses a UNumberFormat to format numbers within a date, 12567777dab0Sopenharmony_ci* for example the day number. 12577777dab0Sopenharmony_ci* @param fmt The formatter to set. 12587777dab0Sopenharmony_ci* @param numberFormatToAdopt A pointer to the UNumberFormat to be used by fmt to format numbers. 12597777dab0Sopenharmony_ci* @see udat_getNumberFormat 12607777dab0Sopenharmony_ci* @stable ICU 54 12617777dab0Sopenharmony_ci*/ 12627777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 12637777dab0Sopenharmony_ciudat_adoptNumberFormat( UDateFormat* fmt, 12647777dab0Sopenharmony_ci UNumberFormat* numberFormatToAdopt); 12657777dab0Sopenharmony_ci/** 12667777dab0Sopenharmony_ci* Get a locale for which date/time formatting patterns are available. 12677777dab0Sopenharmony_ci* A UDateFormat in a locale returned by this function will perform the correct 12687777dab0Sopenharmony_ci* formatting and parsing for the locale. 12697777dab0Sopenharmony_ci* @param localeIndex The index of the desired locale. 12707777dab0Sopenharmony_ci* @return A locale for which date/time formatting patterns are available, or 0 if none. 12717777dab0Sopenharmony_ci* @see udat_countAvailable 12727777dab0Sopenharmony_ci* @stable ICU 2.0 12737777dab0Sopenharmony_ci*/ 12747777dab0Sopenharmony_ciU_CAPI const char* U_EXPORT2 12757777dab0Sopenharmony_ciudat_getAvailable(int32_t localeIndex); 12767777dab0Sopenharmony_ci 12777777dab0Sopenharmony_ci/** 12787777dab0Sopenharmony_ci* Determine how many locales have date/time formatting patterns available. 12797777dab0Sopenharmony_ci* This function is most useful as determining the loop ending condition for 12807777dab0Sopenharmony_ci* calls to {@link #udat_getAvailable }. 12817777dab0Sopenharmony_ci* @return The number of locales for which date/time formatting patterns are available. 12827777dab0Sopenharmony_ci* @see udat_getAvailable 12837777dab0Sopenharmony_ci* @stable ICU 2.0 12847777dab0Sopenharmony_ci*/ 12857777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 12867777dab0Sopenharmony_ciudat_countAvailable(void); 12877777dab0Sopenharmony_ci 12887777dab0Sopenharmony_ci/** 12897777dab0Sopenharmony_ci* Get the year relative to which all 2-digit years are interpreted. 12907777dab0Sopenharmony_ci* For example, if the 2-digit start year is 2100, the year 99 will be 12917777dab0Sopenharmony_ci* interpreted as 2199. 12927777dab0Sopenharmony_ci* @param fmt The formatter to query. 12937777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors 12947777dab0Sopenharmony_ci* @return The year relative to which all 2-digit years are interpreted. 12957777dab0Sopenharmony_ci* @see udat_Set2DigitYearStart 12967777dab0Sopenharmony_ci* @stable ICU 2.0 12977777dab0Sopenharmony_ci*/ 12987777dab0Sopenharmony_ciU_CAPI UDate U_EXPORT2 12997777dab0Sopenharmony_ciudat_get2DigitYearStart( const UDateFormat *fmt, 13007777dab0Sopenharmony_ci UErrorCode *status); 13017777dab0Sopenharmony_ci 13027777dab0Sopenharmony_ci/** 13037777dab0Sopenharmony_ci* Set the year relative to which all 2-digit years will be interpreted. 13047777dab0Sopenharmony_ci* For example, if the 2-digit start year is 2100, the year 99 will be 13057777dab0Sopenharmony_ci* interpreted as 2199. 13067777dab0Sopenharmony_ci* @param fmt The formatter to set. 13077777dab0Sopenharmony_ci* @param d The year relative to which all 2-digit years will be interpreted. 13087777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors 13097777dab0Sopenharmony_ci* @see udat_Set2DigitYearStart 13107777dab0Sopenharmony_ci* @stable ICU 2.0 13117777dab0Sopenharmony_ci*/ 13127777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 13137777dab0Sopenharmony_ciudat_set2DigitYearStart( UDateFormat *fmt, 13147777dab0Sopenharmony_ci UDate d, 13157777dab0Sopenharmony_ci UErrorCode *status); 13167777dab0Sopenharmony_ci 13177777dab0Sopenharmony_ci/** 13187777dab0Sopenharmony_ci* Extract the pattern from a UDateFormat. 13197777dab0Sopenharmony_ci* The pattern will follow the pattern syntax rules. 13207777dab0Sopenharmony_ci* @param fmt The formatter to query. 13217777dab0Sopenharmony_ci* @param localized true if the pattern should be localized, false otherwise. 13227777dab0Sopenharmony_ci* @param result A pointer to a buffer to receive the pattern. 13237777dab0Sopenharmony_ci* @param resultLength The maximum size of result. 13247777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors 13257777dab0Sopenharmony_ci* @return The total buffer size needed; if greater than resultLength, the output was truncated. 13267777dab0Sopenharmony_ci* @see udat_applyPattern 13277777dab0Sopenharmony_ci* @stable ICU 2.0 13287777dab0Sopenharmony_ci*/ 13297777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 13307777dab0Sopenharmony_ciudat_toPattern( const UDateFormat *fmt, 13317777dab0Sopenharmony_ci UBool localized, 13327777dab0Sopenharmony_ci UChar *result, 13337777dab0Sopenharmony_ci int32_t resultLength, 13347777dab0Sopenharmony_ci UErrorCode *status); 13357777dab0Sopenharmony_ci 13367777dab0Sopenharmony_ci/** 13377777dab0Sopenharmony_ci* Set the pattern used by an UDateFormat. 13387777dab0Sopenharmony_ci* The pattern should follow the pattern syntax rules. 13397777dab0Sopenharmony_ci* @param format The formatter to set. 13407777dab0Sopenharmony_ci* @param localized true if the pattern is localized, false otherwise. 13417777dab0Sopenharmony_ci* @param pattern The new pattern 13427777dab0Sopenharmony_ci* @param patternLength The length of pattern, or -1 if null-terminated. 13437777dab0Sopenharmony_ci* @see udat_toPattern 13447777dab0Sopenharmony_ci* @stable ICU 2.0 13457777dab0Sopenharmony_ci*/ 13467777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 13477777dab0Sopenharmony_ciudat_applyPattern( UDateFormat *format, 13487777dab0Sopenharmony_ci UBool localized, 13497777dab0Sopenharmony_ci const UChar *pattern, 13507777dab0Sopenharmony_ci int32_t patternLength); 13517777dab0Sopenharmony_ci 13527777dab0Sopenharmony_ci/** 13537777dab0Sopenharmony_ci * The possible types of date format symbols 13547777dab0Sopenharmony_ci * @stable ICU 2.6 13557777dab0Sopenharmony_ci */ 13567777dab0Sopenharmony_citypedef enum UDateFormatSymbolType { 13577777dab0Sopenharmony_ci /** The era names, for example AD */ 13587777dab0Sopenharmony_ci UDAT_ERAS, 13597777dab0Sopenharmony_ci /** The month names, for example February */ 13607777dab0Sopenharmony_ci UDAT_MONTHS, 13617777dab0Sopenharmony_ci /** The short month names, for example Feb. */ 13627777dab0Sopenharmony_ci UDAT_SHORT_MONTHS, 13637777dab0Sopenharmony_ci /** The CLDR-style format "wide" weekday names, for example Monday */ 13647777dab0Sopenharmony_ci UDAT_WEEKDAYS, 13657777dab0Sopenharmony_ci /** 13667777dab0Sopenharmony_ci * The CLDR-style format "abbreviated" (not "short") weekday names, for example "Mon." 13677777dab0Sopenharmony_ci * For the CLDR-style format "short" weekday names, use UDAT_SHORTER_WEEKDAYS. 13687777dab0Sopenharmony_ci */ 13697777dab0Sopenharmony_ci UDAT_SHORT_WEEKDAYS, 13707777dab0Sopenharmony_ci /** The AM/PM names, for example AM */ 13717777dab0Sopenharmony_ci UDAT_AM_PMS, 13727777dab0Sopenharmony_ci /** The localized characters */ 13737777dab0Sopenharmony_ci UDAT_LOCALIZED_CHARS, 13747777dab0Sopenharmony_ci /** The long era names, for example Anno Domini */ 13757777dab0Sopenharmony_ci UDAT_ERA_NAMES, 13767777dab0Sopenharmony_ci /** The narrow month names, for example F */ 13777777dab0Sopenharmony_ci UDAT_NARROW_MONTHS, 13787777dab0Sopenharmony_ci /** The CLDR-style format "narrow" weekday names, for example "M" */ 13797777dab0Sopenharmony_ci UDAT_NARROW_WEEKDAYS, 13807777dab0Sopenharmony_ci /** Standalone context versions of months */ 13817777dab0Sopenharmony_ci UDAT_STANDALONE_MONTHS, 13827777dab0Sopenharmony_ci UDAT_STANDALONE_SHORT_MONTHS, 13837777dab0Sopenharmony_ci UDAT_STANDALONE_NARROW_MONTHS, 13847777dab0Sopenharmony_ci /** The CLDR-style stand-alone "wide" weekday names */ 13857777dab0Sopenharmony_ci UDAT_STANDALONE_WEEKDAYS, 13867777dab0Sopenharmony_ci /** 13877777dab0Sopenharmony_ci * The CLDR-style stand-alone "abbreviated" (not "short") weekday names. 13887777dab0Sopenharmony_ci * For the CLDR-style stand-alone "short" weekday names, use UDAT_STANDALONE_SHORTER_WEEKDAYS. 13897777dab0Sopenharmony_ci */ 13907777dab0Sopenharmony_ci UDAT_STANDALONE_SHORT_WEEKDAYS, 13917777dab0Sopenharmony_ci /** The CLDR-style stand-alone "narrow" weekday names */ 13927777dab0Sopenharmony_ci UDAT_STANDALONE_NARROW_WEEKDAYS, 13937777dab0Sopenharmony_ci /** The quarters, for example 1st Quarter */ 13947777dab0Sopenharmony_ci UDAT_QUARTERS, 13957777dab0Sopenharmony_ci /** The short quarter names, for example Q1 */ 13967777dab0Sopenharmony_ci UDAT_SHORT_QUARTERS, 13977777dab0Sopenharmony_ci /** Standalone context versions of quarters */ 13987777dab0Sopenharmony_ci UDAT_STANDALONE_QUARTERS, 13997777dab0Sopenharmony_ci UDAT_STANDALONE_SHORT_QUARTERS, 14007777dab0Sopenharmony_ci /** 14017777dab0Sopenharmony_ci * The CLDR-style short weekday names, e.g. "Su", Mo", etc. 14027777dab0Sopenharmony_ci * These are named "SHORTER" to contrast with the constants using _SHORT_ 14037777dab0Sopenharmony_ci * above, which actually get the CLDR-style *abbreviated* versions of the 14047777dab0Sopenharmony_ci * corresponding names. 14057777dab0Sopenharmony_ci * @stable ICU 51 14067777dab0Sopenharmony_ci */ 14077777dab0Sopenharmony_ci UDAT_SHORTER_WEEKDAYS, 14087777dab0Sopenharmony_ci /** 14097777dab0Sopenharmony_ci * Standalone version of UDAT_SHORTER_WEEKDAYS. 14107777dab0Sopenharmony_ci * @stable ICU 51 14117777dab0Sopenharmony_ci */ 14127777dab0Sopenharmony_ci UDAT_STANDALONE_SHORTER_WEEKDAYS, 14137777dab0Sopenharmony_ci /** 14147777dab0Sopenharmony_ci * Cyclic year names (only supported for some calendars, and only for FORMAT usage; 14157777dab0Sopenharmony_ci * udat_setSymbols not supported for UDAT_CYCLIC_YEARS_WIDE) 14167777dab0Sopenharmony_ci * @stable ICU 54 14177777dab0Sopenharmony_ci */ 14187777dab0Sopenharmony_ci UDAT_CYCLIC_YEARS_WIDE, 14197777dab0Sopenharmony_ci /** 14207777dab0Sopenharmony_ci * Cyclic year names (only supported for some calendars, and only for FORMAT usage) 14217777dab0Sopenharmony_ci * @stable ICU 54 14227777dab0Sopenharmony_ci */ 14237777dab0Sopenharmony_ci UDAT_CYCLIC_YEARS_ABBREVIATED, 14247777dab0Sopenharmony_ci /** 14257777dab0Sopenharmony_ci * Cyclic year names (only supported for some calendars, and only for FORMAT usage; 14267777dab0Sopenharmony_ci * udat_setSymbols not supported for UDAT_CYCLIC_YEARS_NARROW) 14277777dab0Sopenharmony_ci * @stable ICU 54 14287777dab0Sopenharmony_ci */ 14297777dab0Sopenharmony_ci UDAT_CYCLIC_YEARS_NARROW, 14307777dab0Sopenharmony_ci /** 14317777dab0Sopenharmony_ci * Calendar zodiac names (only supported for some calendars, and only for FORMAT usage; 14327777dab0Sopenharmony_ci * udat_setSymbols not supported for UDAT_ZODIAC_NAMES_WIDE) 14337777dab0Sopenharmony_ci * @stable ICU 54 14347777dab0Sopenharmony_ci */ 14357777dab0Sopenharmony_ci UDAT_ZODIAC_NAMES_WIDE, 14367777dab0Sopenharmony_ci /** 14377777dab0Sopenharmony_ci * Calendar zodiac names (only supported for some calendars, and only for FORMAT usage) 14387777dab0Sopenharmony_ci * @stable ICU 54 14397777dab0Sopenharmony_ci */ 14407777dab0Sopenharmony_ci UDAT_ZODIAC_NAMES_ABBREVIATED, 14417777dab0Sopenharmony_ci /** 14427777dab0Sopenharmony_ci * Calendar zodiac names (only supported for some calendars, and only for FORMAT usage; 14437777dab0Sopenharmony_ci * udat_setSymbols not supported for UDAT_ZODIAC_NAMES_NARROW) 14447777dab0Sopenharmony_ci * @stable ICU 54 14457777dab0Sopenharmony_ci */ 14467777dab0Sopenharmony_ci UDAT_ZODIAC_NAMES_NARROW, 14477777dab0Sopenharmony_ci 14487777dab0Sopenharmony_ci /** 14497777dab0Sopenharmony_ci * The narrow quarter names, for example 1 14507777dab0Sopenharmony_ci * @stable ICU 70 14517777dab0Sopenharmony_ci */ 14527777dab0Sopenharmony_ci UDAT_NARROW_QUARTERS, 14537777dab0Sopenharmony_ci 14547777dab0Sopenharmony_ci /** 14557777dab0Sopenharmony_ci * The narrow standalone quarter names, for example 1 14567777dab0Sopenharmony_ci * @stable ICU 70 14577777dab0Sopenharmony_ci */ 14587777dab0Sopenharmony_ci UDAT_STANDALONE_NARROW_QUARTERS 14597777dab0Sopenharmony_ci} UDateFormatSymbolType; 14607777dab0Sopenharmony_ci 14617777dab0Sopenharmony_cistruct UDateFormatSymbols; 14627777dab0Sopenharmony_ci/** Date format symbols. 14637777dab0Sopenharmony_ci * For usage in C programs. 14647777dab0Sopenharmony_ci * @stable ICU 2.6 14657777dab0Sopenharmony_ci */ 14667777dab0Sopenharmony_citypedef struct UDateFormatSymbols UDateFormatSymbols; 14677777dab0Sopenharmony_ci 14687777dab0Sopenharmony_ci/** 14697777dab0Sopenharmony_ci* Get the symbols associated with an UDateFormat. 14707777dab0Sopenharmony_ci* The symbols are what a UDateFormat uses to represent locale-specific data, 14717777dab0Sopenharmony_ci* for example month or day names. 14727777dab0Sopenharmony_ci* @param fmt The formatter to query. 14737777dab0Sopenharmony_ci* @param type The type of symbols to get. One of UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS, 14747777dab0Sopenharmony_ci* UDAT_WEEKDAYS, UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, or UDAT_LOCALIZED_CHARS 14757777dab0Sopenharmony_ci* @param symbolIndex The desired symbol of type type. 14767777dab0Sopenharmony_ci* @param result A pointer to a buffer to receive the pattern. 14777777dab0Sopenharmony_ci* @param resultLength The maximum size of result. 14787777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors 14797777dab0Sopenharmony_ci* @return The total buffer size needed; if greater than resultLength, the output was truncated. 14807777dab0Sopenharmony_ci* @see udat_countSymbols 14817777dab0Sopenharmony_ci* @see udat_setSymbols 14827777dab0Sopenharmony_ci* @stable ICU 2.0 14837777dab0Sopenharmony_ci*/ 14847777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 14857777dab0Sopenharmony_ciudat_getSymbols(const UDateFormat *fmt, 14867777dab0Sopenharmony_ci UDateFormatSymbolType type, 14877777dab0Sopenharmony_ci int32_t symbolIndex, 14887777dab0Sopenharmony_ci UChar *result, 14897777dab0Sopenharmony_ci int32_t resultLength, 14907777dab0Sopenharmony_ci UErrorCode *status); 14917777dab0Sopenharmony_ci 14927777dab0Sopenharmony_ci/** 14937777dab0Sopenharmony_ci* Count the number of particular symbols for an UDateFormat. 14947777dab0Sopenharmony_ci* This function is most useful as for determining the loop termination condition 14957777dab0Sopenharmony_ci* for calls to {@link #udat_getSymbols }. 14967777dab0Sopenharmony_ci* @param fmt The formatter to query. 14977777dab0Sopenharmony_ci* @param type The type of symbols to count. One of UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS, 14987777dab0Sopenharmony_ci* UDAT_WEEKDAYS, UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, or UDAT_LOCALIZED_CHARS 14997777dab0Sopenharmony_ci* @return The number of symbols of type type. 15007777dab0Sopenharmony_ci* @see udat_getSymbols 15017777dab0Sopenharmony_ci* @see udat_setSymbols 15027777dab0Sopenharmony_ci* @stable ICU 2.0 15037777dab0Sopenharmony_ci*/ 15047777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 15057777dab0Sopenharmony_ciudat_countSymbols( const UDateFormat *fmt, 15067777dab0Sopenharmony_ci UDateFormatSymbolType type); 15077777dab0Sopenharmony_ci 15087777dab0Sopenharmony_ci/** 15097777dab0Sopenharmony_ci* Set the symbols associated with an UDateFormat. 15107777dab0Sopenharmony_ci* The symbols are what a UDateFormat uses to represent locale-specific data, 15117777dab0Sopenharmony_ci* for example month or day names. 15127777dab0Sopenharmony_ci* @param format The formatter to set 15137777dab0Sopenharmony_ci* @param type The type of symbols to set. One of UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS, 15147777dab0Sopenharmony_ci* UDAT_WEEKDAYS, UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, or UDAT_LOCALIZED_CHARS 15157777dab0Sopenharmony_ci* @param symbolIndex The index of the symbol to set of type type. 15167777dab0Sopenharmony_ci* @param value The new value 15177777dab0Sopenharmony_ci* @param valueLength The length of value, or -1 if null-terminated 15187777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors 15197777dab0Sopenharmony_ci* @see udat_getSymbols 15207777dab0Sopenharmony_ci* @see udat_countSymbols 15217777dab0Sopenharmony_ci* @stable ICU 2.0 15227777dab0Sopenharmony_ci*/ 15237777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 15247777dab0Sopenharmony_ciudat_setSymbols( UDateFormat *format, 15257777dab0Sopenharmony_ci UDateFormatSymbolType type, 15267777dab0Sopenharmony_ci int32_t symbolIndex, 15277777dab0Sopenharmony_ci UChar *value, 15287777dab0Sopenharmony_ci int32_t valueLength, 15297777dab0Sopenharmony_ci UErrorCode *status); 15307777dab0Sopenharmony_ci 15317777dab0Sopenharmony_ci/** 15327777dab0Sopenharmony_ci * Get the locale for this date format object. 15337777dab0Sopenharmony_ci * You can choose between valid and actual locale. 15347777dab0Sopenharmony_ci * @param fmt The formatter to get the locale from 15357777dab0Sopenharmony_ci * @param type type of the locale we're looking for (valid or actual) 15367777dab0Sopenharmony_ci * @param status error code for the operation 15377777dab0Sopenharmony_ci * @return the locale name 15387777dab0Sopenharmony_ci * @stable ICU 2.8 15397777dab0Sopenharmony_ci */ 15407777dab0Sopenharmony_ciU_CAPI const char* U_EXPORT2 15417777dab0Sopenharmony_ciudat_getLocaleByType(const UDateFormat *fmt, 15427777dab0Sopenharmony_ci ULocDataLocaleType type, 15437777dab0Sopenharmony_ci UErrorCode* status); 15447777dab0Sopenharmony_ci 15457777dab0Sopenharmony_ci/** 15467777dab0Sopenharmony_ci * Set a particular UDisplayContext value in the formatter, such as 15477777dab0Sopenharmony_ci * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. 15487777dab0Sopenharmony_ci * @param fmt The formatter for which to set a UDisplayContext value. 15497777dab0Sopenharmony_ci * @param value The UDisplayContext value to set. 15507777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors 15517777dab0Sopenharmony_ci * @stable ICU 51 15527777dab0Sopenharmony_ci */ 15537777dab0Sopenharmony_ciU_CAPI void U_EXPORT2 15547777dab0Sopenharmony_ciudat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status); 15557777dab0Sopenharmony_ci 15567777dab0Sopenharmony_ci/** 15577777dab0Sopenharmony_ci * Get the formatter's UDisplayContext value for the specified UDisplayContextType, 15587777dab0Sopenharmony_ci * such as UDISPCTX_TYPE_CAPITALIZATION. 15597777dab0Sopenharmony_ci * @param fmt The formatter to query. 15607777dab0Sopenharmony_ci * @param type The UDisplayContextType whose value to return 15617777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors 15627777dab0Sopenharmony_ci * @return The UDisplayContextValue for the specified type. 15637777dab0Sopenharmony_ci * @stable ICU 53 15647777dab0Sopenharmony_ci */ 15657777dab0Sopenharmony_ciU_CAPI UDisplayContext U_EXPORT2 15667777dab0Sopenharmony_ciudat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* status); 15677777dab0Sopenharmony_ci 15687777dab0Sopenharmony_ci#ifndef U_HIDE_INTERNAL_API 15697777dab0Sopenharmony_ci 15707777dab0Sopenharmony_ci 15717777dab0Sopenharmony_ci/** 15727777dab0Sopenharmony_ci * @internal 15737777dab0Sopenharmony_ci * @see udat_open 15747777dab0Sopenharmony_ci */ 15757777dab0Sopenharmony_citypedef UDateFormat* (U_EXPORT2 *UDateFormatOpener) (UDateFormatStyle timeStyle, 15767777dab0Sopenharmony_ci UDateFormatStyle dateStyle, 15777777dab0Sopenharmony_ci const char *locale, 15787777dab0Sopenharmony_ci const UChar *tzID, 15797777dab0Sopenharmony_ci int32_t tzIDLength, 15807777dab0Sopenharmony_ci const UChar *pattern, 15817777dab0Sopenharmony_ci int32_t patternLength, 15827777dab0Sopenharmony_ci UErrorCode *status); 15837777dab0Sopenharmony_ci 15847777dab0Sopenharmony_ci 15857777dab0Sopenharmony_ci#endif /* U_HIDE_INTERNAL_API */ 15867777dab0Sopenharmony_ci#endif /* #if !UCONFIG_NO_FORMATTING */ 15877777dab0Sopenharmony_ci 15887777dab0Sopenharmony_ci#endif 1589