13#if !UCONFIG_NO_FORMATTING
18#include "unicode/udisplaycontext.h"
194#define UDAT_QUARTER "QQQQ"
199#define UDAT_ABBR_QUARTER "QQQ"
204#define UDAT_YEAR_QUARTER "yQQQQ"
209#define UDAT_YEAR_ABBR_QUARTER "yQQQ"
214#define UDAT_MONTH "MMMM"
219#define UDAT_ABBR_MONTH "MMM"
224#define UDAT_NUM_MONTH "M"
229#define UDAT_YEAR_MONTH "yMMMM"
234#define UDAT_YEAR_ABBR_MONTH "yMMM"
239#define UDAT_YEAR_NUM_MONTH "yM"
250#define UDAT_YEAR_MONTH_DAY "yMMMMd"
256#define UDAT_YEAR_ABBR_MONTH_DAY "yMMMd"
262#define UDAT_YEAR_NUM_MONTH_DAY "yMd"
267#define UDAT_WEEKDAY "EEEE"
272#define UDAT_ABBR_WEEKDAY "E"
278#define UDAT_YEAR_MONTH_WEEKDAY_DAY "yMMMMEEEEd"
284#define UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY "yMMMEd"
290#define UDAT_YEAR_NUM_MONTH_WEEKDAY_DAY "yMEd"
296#define UDAT_MONTH_DAY "MMMMd"
302#define UDAT_ABBR_MONTH_DAY "MMMd"
308#define UDAT_NUM_MONTH_DAY "Md"
314#define UDAT_MONTH_WEEKDAY_DAY "MMMMEEEEd"
320#define UDAT_ABBR_MONTH_WEEKDAY_DAY "MMMEd"
326#define UDAT_NUM_MONTH_WEEKDAY_DAY "MEd"
339#define UDAT_HOUR24 "H"
344#define UDAT_MINUTE "m"
350#define UDAT_HOUR_MINUTE "jm"
356#define UDAT_HOUR24_MINUTE "Hm"
361#define UDAT_SECOND "s"
368#define UDAT_HOUR_MINUTE_SECOND "jms"
375#define UDAT_HOUR24_MINUTE_SECOND "Hms"
381#define UDAT_MINUTE_SECOND "ms"
392#define UDAT_LOCATION_TZ "VVVV"
400#define UDAT_GENERIC_TZ "vvvv"
408#define UDAT_ABBR_GENERIC_TZ "v"
416#define UDAT_SPECIFIC_TZ "zzzz"
424#define UDAT_ABBR_SPECIFIC_TZ "z"
432#define UDAT_ABBR_UTC_TZ "ZZZZ"
440#define UDAT_STANDALONE_MONTH "LLLL"
445#define UDAT_ABBR_STANDALONE_MONTH "LLL"
451#define UDAT_HOUR_MINUTE_GENERIC_TZ "jmv"
456#define UDAT_HOUR_MINUTE_TZ "jmz"
461#define UDAT_HOUR_GENERIC_TZ "jv"
466#define UDAT_HOUR_TZ "jz"
775 const UChar *pattern,
776 int32_t patternLength,
789#if U_SHOW_CPLUSPLUS_API
842 int32_t resultLength,
1050 int32_t resultLength,
1066 const UChar *pattern,
1067 int32_t patternLength);
1096 UDAT_STANDALONE_SHORT_MONTHS,
1097 UDAT_STANDALONE_NARROW_MONTHS,
1100 UDAT_STANDALONE_SHORT_WEEKDAYS,
1101 UDAT_STANDALONE_NARROW_WEEKDAYS,
1108 UDAT_STANDALONE_SHORT_QUARTERS
1138 int32_t symbolIndex,
1140 int32_t resultLength,
1177 int32_t symbolIndex,
1179 int32_t valueLength,
1196#ifndef U_HIDE_INTERNAL_API
1222#ifndef U_HIDE_INTERNAL_API
1237 int32_t resultLength,
1254 int32_t resultLength,
1271 const UChar *datePattern,
1272 int32_t datePatternLength,
1273 const UChar *timePattern,
1274 int32_t timePatternLength,
1287 const UChar *pattern,
1288 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.
int32_t udat_toPattern(const UDateFormat *fmt, UBool localized, UChar *result, int32_t resultLength, UErrorCode *status)
Extract the pattern from a UDateFormat.
void udat_set2DigitYearStart(UDateFormat *fmt, UDate d, UErrorCode *status)
Set the year relative to which all 2-digit years will be interpreted.
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.
UDate udat_get2DigitYearStart(const UDateFormat *fmt, UErrorCode *status)
Get the year relative to which all 2-digit years are interpreted.
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.
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.
void udat_setContext(UDateFormat *fmt, UDisplayContext value, UErrorCode *status)
Set a particular UDisplayContext value in the formatter, such as UDISPCTX_CAPITALIZATION_FOR_STANDALO...
void udat_applyPattern(UDateFormat *format, UBool localized, const UChar *pattern, int32_t patternLength)
Set the pattern used by an UDateFormat.
int32_t udat_countAvailable(void)
Determine how many locales have date/time formatting patterns available.
void udat_setLenient(UDateFormat *fmt, UBool isLenient)
Specify whether an UDateFormat will perform lenient parsing.
UDateFormat *(* UDateFormatOpener)(UDateFormatStyle timeStyle, UDateFormatStyle dateStyle, const char *locale, const UChar *tzID, int32_t tzIDLength, const UChar *pattern, int32_t patternLength, UErrorCode *status)
UCalendarDateFields udat_toCalendarDateField(UDateFormatField field)
Maps from a UDateFormatField to the corresponding UCalendarDateFields.
UDateFormatSymbolType
The possible types of date format symbols.
@ UDAT_ERAS
The era names, for example AD.
@ UDAT_SHORT_QUARTERS
The short quarter names, for example Q1.
@ UDAT_STANDALONE_QUARTERS
Standalone context versions of quarters.
@ UDAT_SHORT_WEEKDAYS
The short weekday names, for example Mon.
@ UDAT_NARROW_WEEKDAYS
The narrow weekday names, for example N.
@ UDAT_STANDALONE_WEEKDAYS
Standalone context versions of weekdays.
@ UDAT_ERA_NAMES
The long era names, for example Anno Domini.
@ UDAT_WEEKDAYS
The weekday names, for example Monday.
@ UDAT_QUARTERS
The quarters, for example 1st Quarter.
@ UDAT_LOCALIZED_CHARS
The localized characters.
@ UDAT_MONTHS
The month names, for example February.
@ UDAT_NARROW_MONTHS
The narrow month names, for example F.
@ UDAT_STANDALONE_MONTHS
Standalone context versions of months.
@ UDAT_SHORT_MONTHS
The short month names, for example Feb.
@ UDAT_AM_PMS
The AM/PM names, for example AM.
UDisplayContext udat_getContext(UDateFormat *fmt, UDisplayContextType type, UErrorCode *status)
Get the formatter's UDisplayContext value for the specified UDisplayContextType, such as UDISPCTX_TYP...
void udat_setNumberFormat(UDateFormat *fmt, const UNumberFormat *numberFormatToSet)
Set the UNumberFormat associated with an UDateFormat.
int32_t udat_format(const UDateFormat *format, UDate dateToFormat, UChar *result, int32_t resultLength, UFieldPosition *position, UErrorCode *status)
Format a date using an UDateFormat.
UDateFormat * udat_clone(const UDateFormat *fmt, UErrorCode *status)
Open a copy of a UDateFormat.
int32_t udat_countSymbols(const UDateFormat *fmt, UDateFormatSymbolType type)
Count the number of particular symbols for an UDateFormat.
const UCalendar * udat_getCalendar(const UDateFormat *fmt)
Get the UCalendar associated with an UDateFormat.
UDateFormatOpener udat_unregisterOpener(UDateFormatOpener opener, UErrorCode *status)
Un-Register a provider factory.
void udat_close(UDateFormat *format)
Close a UDateFormat.
struct UDateFormatSymbols UDateFormatSymbols
Date format symbols.
void udat_setCalendar(UDateFormat *fmt, const UCalendar *calendarToSet)
Set the UCalendar associated with an UDateFormat.
const UNumberFormat * udat_getNumberFormat(const UDateFormat *fmt)
Get the UNumberFormat associated with an UDateFormat.
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.
const char * udat_getLocaleByType(const UDateFormat *fmt, ULocDataLocaleType type, UErrorCode *status)
Get the locale for this date format object.
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.
void udat_registerOpener(UDateFormatOpener opener, UErrorCode *status)
Register a provider factory.
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.
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_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_DAY_OF_WEEK_IN_MONTH_FIELD
FieldPosition and UFieldPosition selector for 'F' field alignment, corresponding to the UCAL_DAY_OF_W...
@ 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_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_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.
const char * udat_getAvailable(int32_t localeIndex)
Get a locale for which date/time formatting patterns are available.
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.
UBool udat_isLenient(const UDateFormat *fmt)
Determine if an UDateFormat will perform lenient parsing.
void udat_setSymbols(UDateFormat *format, UDateFormatSymbolType type, int32_t symbolIndex, UChar *value, int32_t valueLength, UErrorCode *status)
Set the symbols associated with an UDateFormat.
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested,...
#define U_INTERNAL
This is used to declare a function as an internal ICU C API.
int8_t UBool
The ICU boolean type.
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
void * UNumberFormat
A number formatter.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
double UDate
Date and Time data type.
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.