15#if !UCONFIG_NO_FORMATTING
22#if U_SHOW_CPLUSPLUS_API
213#define UDAT_QUARTER "QQQQ"
218#define UDAT_ABBR_QUARTER "QQQ"
223#define UDAT_YEAR_QUARTER "yQQQQ"
228#define UDAT_YEAR_ABBR_QUARTER "yQQQ"
233#define UDAT_MONTH "MMMM"
238#define UDAT_ABBR_MONTH "MMM"
243#define UDAT_NUM_MONTH "M"
248#define UDAT_YEAR_MONTH "yMMMM"
253#define UDAT_YEAR_ABBR_MONTH "yMMM"
258#define UDAT_YEAR_NUM_MONTH "yM"
269#define UDAT_YEAR_MONTH_DAY "yMMMMd"
275#define UDAT_YEAR_ABBR_MONTH_DAY "yMMMd"
281#define UDAT_YEAR_NUM_MONTH_DAY "yMd"
286#define UDAT_WEEKDAY "EEEE"
291#define UDAT_ABBR_WEEKDAY "E"
297#define UDAT_YEAR_MONTH_WEEKDAY_DAY "yMMMMEEEEd"
303#define UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY "yMMMEd"
309#define UDAT_YEAR_NUM_MONTH_WEEKDAY_DAY "yMEd"
315#define UDAT_MONTH_DAY "MMMMd"
321#define UDAT_ABBR_MONTH_DAY "MMMd"
327#define UDAT_NUM_MONTH_DAY "Md"
333#define UDAT_MONTH_WEEKDAY_DAY "MMMMEEEEd"
339#define UDAT_ABBR_MONTH_WEEKDAY_DAY "MMMEd"
345#define UDAT_NUM_MONTH_WEEKDAY_DAY "MEd"
358#define UDAT_HOUR24 "H"
363#define UDAT_MINUTE "m"
369#define UDAT_HOUR_MINUTE "jm"
375#define UDAT_HOUR24_MINUTE "Hm"
380#define UDAT_SECOND "s"
387#define UDAT_HOUR_MINUTE_SECOND "jms"
394#define UDAT_HOUR24_MINUTE_SECOND "Hms"
400#define UDAT_MINUTE_SECOND "ms"
411#define UDAT_LOCATION_TZ "VVVV"
419#define UDAT_GENERIC_TZ "vvvv"
427#define UDAT_ABBR_GENERIC_TZ "v"
435#define UDAT_SPECIFIC_TZ "zzzz"
443#define UDAT_ABBR_SPECIFIC_TZ "z"
451#define UDAT_ABBR_UTC_TZ "ZZZZ"
455#ifndef U_HIDE_DEPRECATED_API
460#define UDAT_STANDALONE_MONTH "LLLL"
465#define UDAT_ABBR_STANDALONE_MONTH "LLL"
471#define UDAT_HOUR_MINUTE_GENERIC_TZ "jmv"
476#define UDAT_HOUR_MINUTE_TZ "jmz"
481#define UDAT_HOUR_GENERIC_TZ "jv"
486#define UDAT_HOUR_TZ "jz"
489#ifndef U_HIDE_INTERNAL_API
495#define JP_ERA_2019_ROOT "Reiwa"
501#define JP_ERA_2019_JA "\\u4EE4\\u548C"
507#define JP_ERA_2019_NARROW "R"
782#ifndef U_HIDE_INTERNAL_API
803 UDAT_FLEXIBLE_DAY_PERIOD_FIELD = 36,
805#ifndef U_HIDE_INTERNAL_API
815#ifndef U_HIDE_DEPRECATED_API
827#ifndef U_HIDE_INTERNAL_API
833#define UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR 0
897 const UChar *pattern,
898 int32_t patternLength,
944#ifndef U_FORCE_HIDE_DEPRECATED_API
1009#if U_SHOW_CPLUSPLUS_API
1062 int32_t resultLength,
1127 int32_t resultLength,
1322 const UChar* fields,
1361U_CAPI const char* U_EXPORT2
1420 int32_t resultLength,
1436 const UChar *pattern,
1437 int32_t patternLength);
1469 UDAT_STANDALONE_SHORT_MONTHS,
1470 UDAT_STANDALONE_NARROW_MONTHS,
1486 UDAT_STANDALONE_SHORT_QUARTERS,
1574 int32_t symbolIndex,
1576 int32_t resultLength,
1613 int32_t symbolIndex,
1615 int32_t valueLength,
1627U_CAPI const char* U_EXPORT2
1655#ifndef U_HIDE_INTERNAL_API
1670 int32_t resultLength,
1687 int32_t resultLength,
1704 const UChar *datePattern,
1705 int32_t datePatternLength,
1706 const UChar *timePattern,
1707 int32_t timePatternLength,
1719 const UChar *pattern,
1720 int32_t patternLength,
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
A struct representing a range of text containing a specific field.
UCalendarDateFields
Possible fields in a UCalendar.
void * UCalendar
A calendar.
U_CAPI void udat_parseCalendar(const UDateFormat *format, UCalendar *calendar, const UChar *text, int32_t textLength, int32_t *parsePos, UErrorCode *status)
Parse a string into an date/time using a UDateFormat.
U_CAPI const char * udat_getLocaleByType(const UDateFormat *fmt, ULocDataLocaleType type, UErrorCode *status)
Get the locale for this date format object.
U_CAPI const char * udat_getAvailable(int32_t localeIndex)
Get a locale for which date/time formatting patterns are available.
U_CAPI void udat_applyPatternRelative(UDateFormat *format, const UChar *datePattern, int32_t datePatternLength, const UChar *timePattern, int32_t timePatternLength, UErrorCode *status)
Set the date & time patterns used by a UDateFormat set for relative date formatting.
void * UDateFormat
A date formatter.
U_CAPI UDateFormat * udat_open(UDateFormatStyle timeStyle, UDateFormatStyle dateStyle, const char *locale, const UChar *tzID, int32_t tzIDLength, const UChar *pattern, int32_t patternLength, UErrorCode *status)
Open a new UDateFormat for formatting and parsing dates and times.
U_CAPI UBool udat_isLenient(const UDateFormat *fmt)
Determine if an UDateFormat will perform lenient parsing.
U_CAPI int32_t udat_formatCalendar(const UDateFormat *format, UCalendar *calendar, UChar *result, int32_t capacity, UFieldPosition *position, UErrorCode *status)
Format a date using an UDateFormat.
U_CAPI UCalendarDateFields udat_toCalendarDateField(UDateFormatField field)
Maps from a UDateFormatField to the corresponding UCalendarDateFields.
U_CAPI void udat_adoptNumberFormatForFields(UDateFormat *fmt, const UChar *fields, UNumberFormat *numberFormatToSet, UErrorCode *status)
Set the UNumberFormat for specific field associated with an UDateFormat.
U_CAPI UDisplayContext udat_getContext(const UDateFormat *fmt, UDisplayContextType type, UErrorCode *status)
Get the formatter's UDisplayContext value for the specified UDisplayContextType, such as UDISPCTX_TYP...
U_CAPI void udat_close(UDateFormat *format)
Close a UDateFormat.
U_CAPI const UNumberFormat * udat_getNumberFormatForField(const UDateFormat *fmt, UChar field)
Get the UNumberFormat for specific field associated with an UDateFormat.
UDateFormat *(* UDateFormatOpener)(UDateFormatStyle timeStyle, UDateFormatStyle dateStyle, const char *locale, const UChar *tzID, int32_t tzIDLength, const UChar *pattern, int32_t patternLength, UErrorCode *status)
UDateFormatSymbolType
The possible types of date format symbols.
@ UDAT_ERAS
The era names, for example AD.
@ UDAT_CYCLIC_YEARS_WIDE
Cyclic year names (only supported for some calendars, and only for FORMAT usage; udat_setSymbols not ...
@ UDAT_CYCLIC_YEARS_NARROW
Cyclic year names (only supported for some calendars, and only for FORMAT usage; udat_setSymbols not ...
@ UDAT_NARROW_QUARTERS
The narrow quarter names, for example 1.
@ UDAT_STANDALONE_NARROW_WEEKDAYS
The CLDR-style stand-alone "narrow" weekday names.
@ UDAT_STANDALONE_NARROW_QUARTERS
The narrow standalone quarter names, for example 1.
@ UDAT_SHORT_QUARTERS
The short quarter names, for example Q1.
@ UDAT_STANDALONE_QUARTERS
Standalone context versions of quarters.
@ UDAT_SHORT_WEEKDAYS
The CLDR-style format "abbreviated" (not "short") weekday names, for example "Mon....
@ UDAT_ZODIAC_NAMES_NARROW
Calendar zodiac names (only supported for some calendars, and only for FORMAT usage; udat_setSymbols ...
@ UDAT_NARROW_WEEKDAYS
The CLDR-style format "narrow" weekday names, for example "M".
@ UDAT_STANDALONE_WEEKDAYS
The CLDR-style stand-alone "wide" weekday names.
@ UDAT_ERA_NAMES
The long era names, for example Anno Domini.
@ UDAT_STANDALONE_SHORTER_WEEKDAYS
Standalone version of UDAT_SHORTER_WEEKDAYS.
@ UDAT_WEEKDAYS
The CLDR-style format "wide" weekday names, for example Monday.
@ UDAT_QUARTERS
The quarters, for example 1st Quarter.
@ UDAT_LOCALIZED_CHARS
The localized characters.
@ UDAT_SHORTER_WEEKDAYS
The CLDR-style short weekday names, e.g.
@ UDAT_ZODIAC_NAMES_ABBREVIATED
Calendar zodiac names (only supported for some calendars, and only for FORMAT usage)
@ UDAT_ZODIAC_NAMES_WIDE
Calendar zodiac names (only supported for some calendars, and only for FORMAT usage; udat_setSymbols ...
@ UDAT_MONTHS
The month names, for example February.
@ UDAT_NARROW_MONTHS
The narrow month names, for example F.
@ UDAT_CYCLIC_YEARS_ABBREVIATED
Cyclic year names (only supported for some calendars, and only for FORMAT usage)
@ UDAT_STANDALONE_MONTHS
Standalone context versions of months.
@ UDAT_STANDALONE_SHORT_WEEKDAYS
The CLDR-style stand-alone "abbreviated" (not "short") weekday names.
@ UDAT_SHORT_MONTHS
The short month names, for example Feb.
@ UDAT_AM_PMS
The AM/PM names, for example AM.
U_CAPI void udat_setNumberFormat(UDateFormat *fmt, const UNumberFormat *numberFormatToSet)
Set the UNumberFormat associated with an UDateFormat.
U_CAPI void udat_set2DigitYearStart(UDateFormat *fmt, UDate d, UErrorCode *status)
Set the year relative to which all 2-digit years will be interpreted.
U_CAPI int32_t udat_formatForFields(const UDateFormat *format, UDate dateToFormat, UChar *result, int32_t resultLength, UFieldPositionIterator *fpositer, UErrorCode *status)
Format a date using a UDateFormat.
U_CAPI UDate udat_parse(const UDateFormat *format, const UChar *text, int32_t textLength, int32_t *parsePos, UErrorCode *status)
Parse a string into an date/time using a UDateFormat.
U_CAPI void udat_setLenient(UDateFormat *fmt, UBool isLenient)
Specify whether an UDateFormat will perform lenient parsing.
U_CAPI int32_t udat_countAvailable(void)
Determine how many locales have date/time formatting patterns available.
U_CAPI const UNumberFormat * udat_getNumberFormat(const UDateFormat *fmt)
Get the UNumberFormat associated with an UDateFormat.
U_CAPI UDateFormatOpener udat_unregisterOpener(UDateFormatOpener opener, UErrorCode *status)
Un-Register a provider factory.
U_CAPI UDateFormat * udat_clone(const UDateFormat *fmt, UErrorCode *status)
Open a copy of a UDateFormat.
U_CAPI void udat_registerOpener(UDateFormatOpener opener, UErrorCode *status)
Register a provider factory.
struct UDateFormatSymbols UDateFormatSymbols
Date format symbols.
U_CAPI void udat_setContext(UDateFormat *fmt, UDisplayContext value, UErrorCode *status)
Set a particular UDisplayContext value in the formatter, such as UDISPCTX_CAPITALIZATION_FOR_STANDALO...
U_CAPI int32_t udat_toPattern(const UDateFormat *fmt, UBool localized, UChar *result, int32_t resultLength, UErrorCode *status)
Extract the pattern from a UDateFormat.
U_CAPI int32_t udat_format(const UDateFormat *format, UDate dateToFormat, UChar *result, int32_t resultLength, UFieldPosition *position, UErrorCode *status)
Format a date using a UDateFormat.
U_CAPI void udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBool newValue, UErrorCode *status)
Set a boolean attribute associated with a UDateFormat.
U_CAPI UDate udat_get2DigitYearStart(const UDateFormat *fmt, UErrorCode *status)
Get the year relative to which all 2-digit years are interpreted.
U_CAPI void udat_adoptNumberFormat(UDateFormat *fmt, UNumberFormat *numberFormatToAdopt)
Adopt the UNumberFormat associated with an UDateFormat.
U_CAPI int32_t udat_countSymbols(const UDateFormat *fmt, UDateFormatSymbolType type)
Count the number of particular symbols for an UDateFormat.
U_CAPI int32_t udat_toPatternRelativeDate(const UDateFormat *fmt, UChar *result, int32_t resultLength, UErrorCode *status)
Extract the date pattern from a UDateFormat set for relative date formatting.
U_CAPI int32_t udat_getSymbols(const UDateFormat *fmt, UDateFormatSymbolType type, int32_t symbolIndex, UChar *result, int32_t resultLength, UErrorCode *status)
Get the symbols associated with an UDateFormat.
U_CAPI void udat_setSymbols(UDateFormat *format, UDateFormatSymbolType type, int32_t symbolIndex, UChar *value, int32_t valueLength, UErrorCode *status)
Set the symbols associated with an UDateFormat.
U_CAPI void udat_setCalendar(UDateFormat *fmt, const UCalendar *calendarToSet)
Set the UCalendar associated with an UDateFormat.
UDateFormatField
FieldPosition and UFieldPosition selectors for format fields defined by DateFormat and UDateFormat.
@ UDAT_AM_PM_FIELD
FieldPosition and UFieldPosition selector for 'a' field alignment, corresponding to the UCAL_AM_PM fi...
@ UDAT_TIMEZONE_FIELD
FieldPosition and UFieldPosition selector for 'z' field alignment, corresponding to the UCAL_ZONE_OFF...
@ UDAT_DOW_LOCAL_FIELD
FieldPosition and UFieldPosition selector for 'e' field alignment, corresponding to the UCAL_DOW_LOCA...
@ UDAT_DATE_FIELD
FieldPosition and UFieldPosition selector for 'd' field alignment, corresponding to the UCAL_DATE fie...
@ UDAT_MONTH_FIELD
FieldPosition and UFieldPosition selector for 'M' field alignment, corresponding to the UCAL_MONTH fi...
@ UDAT_JULIAN_DAY_FIELD
FieldPosition and UFieldPosition selector for 'g' field alignment, corresponding to the UCAL_JULIAN_D...
@ UDAT_FIELD_COUNT
Number of FieldPosition and UFieldPosition selectors for DateFormat and UDateFormat.
@ UDAT_EXTENDED_YEAR_FIELD
FieldPosition and UFieldPosition selector for 'u' field alignment, corresponding to the UCAL_EXTENDED...
@ UDAT_RELATED_YEAR_FIELD
FieldPosition and UFieldPosition selector for 'r' field alignment, no directly corresponding UCAL_ fi...
@ UDAT_DAY_OF_WEEK_FIELD
FieldPosition and UFieldPosition selector for 'E' field alignment, corresponding to the UCAL_DAY_OF_W...
@ UDAT_MILLISECONDS_IN_DAY_FIELD
FieldPosition and UFieldPosition selector for 'A' field alignment, corresponding to the UCAL_MILLISEC...
@ UDAT_TIMEZONE_SPECIAL_FIELD
FieldPosition and UFieldPosition selector for 'V' field alignment, corresponding to the UCAL_ZONE_OFF...
@ UDAT_YEAR_FIELD
FieldPosition and UFieldPosition selector for 'y' field alignment, corresponding to the UCAL_YEAR fie...
@ UDAT_ERA_FIELD
FieldPosition and UFieldPosition selector for 'G' field alignment, corresponding to the UCAL_ERA fiel...
@ UDAT_STANDALONE_QUARTER_FIELD
FieldPosition selector for the "q" field alignment, corresponding to stand-alone quarters.
@ UDAT_QUARTER_FIELD
FieldPosition selector for "Q" field alignment, corresponding to quarters.
@ UDAT_TIMEZONE_RFC_FIELD
FieldPosition and UFieldPosition selector for 'Z' field alignment, corresponding to the UCAL_ZONE_OFF...
@ UDAT_DAY_OF_YEAR_FIELD
FieldPosition and UFieldPosition selector for 'D' field alignment, corresponding to the UCAL_DAY_OF_Y...
@ UDAT_WEEK_OF_MONTH_FIELD
FieldPosition and UFieldPosition selector for 'W' field alignment, corresponding to the UCAL_WEEK_OF_...
@ UDAT_FRACTIONAL_SECOND_FIELD
FieldPosition and UFieldPosition selector for 'S' field alignment, corresponding to the UCAL_MILLISEC...
@ UDAT_STANDALONE_DAY_FIELD
FieldPosition selector for 'c' field alignment, corresponding to the UCAL_DOW_LOCAL field.
@ UDAT_TIME_SEPARATOR_FIELD
FieldPosition and UFieldPosition selector for time separator, no corresponding UCAL_ field.
@ UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD
FieldPosition selector for 'O' field alignment, corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OF...
@ UDAT_DAY_OF_WEEK_IN_MONTH_FIELD
FieldPosition and UFieldPosition selector for 'F' field alignment, corresponding to the UCAL_DAY_OF_W...
@ UDAT_TIMEZONE_ISO_LOCAL_FIELD
FieldPosition selector for 'x' field alignment, corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OF...
@ UDAT_SECOND_FIELD
FieldPosition and UFieldPosition selector for 's' field alignment, corresponding to the UCAL_SECOND f...
@ UDAT_HOUR1_FIELD
FieldPosition and UFieldPosition selector for 'h' field alignment, corresponding to the UCAL_HOUR fie...
@ UDAT_YEAR_NAME_FIELD
FieldPosition selector for "U" field alignment, corresponding to cyclic year names.
@ UDAT_AM_PM_MIDNIGHT_NOON_FIELD
FieldPosition selector for 'b' field alignment.
@ UDAT_MINUTE_FIELD
FieldPosition and UFieldPosition selector for 'm' field alignment, corresponding to the UCAL_MINUTE f...
@ UDAT_TIMEZONE_GENERIC_FIELD
FieldPosition and UFieldPosition selector for 'v' field alignment, corresponding to the UCAL_ZONE_OFF...
@ UDAT_HOUR0_FIELD
FieldPosition and UFieldPosition selector for 'K' field alignment, corresponding to the UCAL_HOUR fie...
@ UDAT_YEAR_WOY_FIELD
FieldPosition and UFieldPosition selector for 'Y' field alignment, corresponding to the UCAL_YEAR_WOY...
@ UDAT_WEEK_OF_YEAR_FIELD
FieldPosition and UFieldPosition selector for 'w' field alignment, corresponding to the UCAL_WEEK_OF_...
@ UDAT_TIMEZONE_ISO_FIELD
FieldPosition selector for 'X' field alignment, corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OF...
@ UDAT_HOUR_OF_DAY0_FIELD
FieldPosition and UFieldPosition selector for 'H' field alignment, corresponding to the UCAL_HOUR_OF_...
@ UDAT_STANDALONE_MONTH_FIELD
FieldPosition selector for 'L' field alignment, corresponding to the UCAL_MONTH field.
@ UDAT_HOUR_OF_DAY1_FIELD
FieldPosition and UFieldPosition selector for 'k' field alignment, corresponding to the UCAL_HOUR_OF_...
UDateFormatStyle
The possible date/time format styles.
@ UDAT_PATTERN
Use the pattern given in the parameter to udat_open.
@ UDAT_RELATIVE
Bitfield for relative date.
@ UDAT_DEFAULT
Default style.
@ UDAT_MEDIUM
Medium style.
UDateFormatHourCycle
Hour Cycle.
@ UDAT_HOUR_CYCLE_11
Hour in am/pm (0~11)
@ UDAT_HOUR_CYCLE_23
Hour in day (0~23)
@ UDAT_HOUR_CYCLE_24
Hour in day (1~24)
@ UDAT_HOUR_CYCLE_12
Hour in am/pm (1~12)
U_CAPI UBool udat_getBooleanAttribute(const UDateFormat *fmt, UDateFormatBooleanAttribute attr, UErrorCode *status)
Get a boolean attribute associated with a UDateFormat.
U_CAPI int32_t udat_formatCalendarForFields(const UDateFormat *format, UCalendar *calendar, UChar *result, int32_t capacity, UFieldPositionIterator *fpositer, UErrorCode *status)
Format a date using a UDateFormat.
U_CAPI const UCalendar * udat_getCalendar(const UDateFormat *fmt)
Get the UCalendar associated with an UDateFormat.
U_CAPI void udat_applyPattern(UDateFormat *format, UBool localized, const UChar *pattern, int32_t patternLength)
Set the pattern used by an UDateFormat.
U_CAPI int32_t udat_toPatternRelativeTime(const UDateFormat *fmt, UChar *result, int32_t resultLength, UErrorCode *status)
Extract the time pattern from a UDateFormat set for relative date formatting.
UDateFormatBooleanAttribute
DateFormat boolean attributes.
@ UDAT_PARSE_ALLOW_WHITESPACE
indicates whether whitespace is allowed.
@ UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH
indicates tolerance of pattern mismatch between input data and specified format pattern.
@ UDAT_BOOLEAN_ATTRIBUTE_COUNT
One more than the highest normal UDateFormatBooleanAttribute value.
@ UDAT_PARSE_PARTIAL_LITERAL_MATCH
indicates tolerance of a partial literal match e.g.
@ UDAT_PARSE_ALLOW_NUMERIC
indicates tolerance of numeric data when String data may be assumed.
C API: Display context types (enum values)
UDisplayContextType
Display context types, for getting values of a particular setting.
UDisplayContext
Display context settings.
C API: UFieldPositionIterator for use with format APIs.
struct UFieldPositionIterator UFieldPositionIterator
C typedef for struct UFieldPositionIterator.
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested,...
int8_t UBool
The ICU boolean type, a signed-byte integer.
#define U_CAPI
This is used to declare a function as a public ICU C API.
char16_t UChar
The base type for UTF-16 code units and pointers.
C API: Compatibility APIs for number formatting.
void * UNumberFormat
A number formatter.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
#define U_HIDE_INTERNAL_API
Define this to 1 to request that internal API be "hidden".
double UDate
Date and Time data type.