udat.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 1996-2016, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*/
#ifndef UDAT_H
#define UDAT_H
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
#include "unicode/ucal.h"
#include "unicode/unum.h"
#include "unicode/udisplaycontext.h"
#include "unicode/ufieldpositer.h"
#if U_SHOW_CPLUSPLUS_API
#include "unicode/localpointer.h"
#endif // U_SHOW_CPLUSPLUS_API
typedef void* UDateFormat;
typedef enum UDateFormatStyle {
UDAT_FULL,
UDAT_LONG,
UDAT_MEDIUM,
UDAT_SHORT,
UDAT_DEFAULT = UDAT_MEDIUM,
UDAT_RELATIVE = (1 << 7),
UDAT_FULL_RELATIVE = UDAT_FULL | UDAT_RELATIVE,
UDAT_LONG_RELATIVE = UDAT_LONG | UDAT_RELATIVE,
UDAT_MEDIUM_RELATIVE = UDAT_MEDIUM | UDAT_RELATIVE,
UDAT_SHORT_RELATIVE = UDAT_SHORT | UDAT_RELATIVE,
UDAT_NONE = -1,
UDAT_PATTERN = -2,
#ifndef U_HIDE_INTERNAL_API
UDAT_IGNORE = UDAT_PATTERN
#endif /* U_HIDE_INTERNAL_API */
} UDateFormatStyle;
/* Skeletons for dates. */
#define UDAT_YEAR "y"
#define UDAT_QUARTER "QQQQ"
#define UDAT_ABBR_QUARTER "QQQ"
#define UDAT_YEAR_QUARTER "yQQQQ"
#define UDAT_YEAR_ABBR_QUARTER "yQQQ"
#define UDAT_MONTH "MMMM"
#define UDAT_ABBR_MONTH "MMM"
#define UDAT_NUM_MONTH "M"
#define UDAT_YEAR_MONTH "yMMMM"
#define UDAT_YEAR_ABBR_MONTH "yMMM"
#define UDAT_YEAR_NUM_MONTH "yM"
#define UDAT_DAY "d"
#define UDAT_YEAR_MONTH_DAY "yMMMMd"
#define UDAT_YEAR_ABBR_MONTH_DAY "yMMMd"
#define UDAT_YEAR_NUM_MONTH_DAY "yMd"
#define UDAT_WEEKDAY "EEEE"
#define UDAT_ABBR_WEEKDAY "E"
#define UDAT_YEAR_MONTH_WEEKDAY_DAY "yMMMMEEEEd"
#define UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY "yMMMEd"
#define UDAT_YEAR_NUM_MONTH_WEEKDAY_DAY "yMEd"
#define UDAT_MONTH_DAY "MMMMd"
#define UDAT_ABBR_MONTH_DAY "MMMd"
#define UDAT_NUM_MONTH_DAY "Md"
#define UDAT_MONTH_WEEKDAY_DAY "MMMMEEEEd"
#define UDAT_ABBR_MONTH_WEEKDAY_DAY "MMMEd"
#define UDAT_NUM_MONTH_WEEKDAY_DAY "MEd"
/* Skeletons for times. */
#define UDAT_HOUR "j"
#define UDAT_HOUR24 "H"
#define UDAT_MINUTE "m"
#define UDAT_HOUR_MINUTE "jm"
#define UDAT_HOUR24_MINUTE "Hm"
#define UDAT_SECOND "s"
#define UDAT_HOUR_MINUTE_SECOND "jms"
#define UDAT_HOUR24_MINUTE_SECOND "Hms"
#define UDAT_MINUTE_SECOND "ms"
/* Skeletons for time zones. */
#define UDAT_LOCATION_TZ "VVVV"
#define UDAT_GENERIC_TZ "vvvv"
#define UDAT_ABBR_GENERIC_TZ "v"
#define UDAT_SPECIFIC_TZ "zzzz"
#define UDAT_ABBR_SPECIFIC_TZ "z"
#define UDAT_ABBR_UTC_TZ "ZZZZ"
/* deprecated skeleton constants */
#ifndef U_HIDE_DEPRECATED_API
#define UDAT_STANDALONE_MONTH "LLLL"
#define UDAT_ABBR_STANDALONE_MONTH "LLL"
#define UDAT_HOUR_MINUTE_GENERIC_TZ "jmv"
#define UDAT_HOUR_MINUTE_TZ "jmz"
#define UDAT_HOUR_GENERIC_TZ "jv"
#define UDAT_HOUR_TZ "jz"
#endif /* U_HIDE_DEPRECATED_API */
#ifndef U_HIDE_INTERNAL_API
#define JP_ERA_2019_ROOT "Reiwa"
#define JP_ERA_2019_JA "\\u4EE4\\u548C"
#define JP_ERA_2019_NARROW "R"
#endif // U_HIDE_INTERNAL_API
typedef enum UDateFormatField {
UDAT_ERA_FIELD = 0,
UDAT_YEAR_FIELD = 1,
UDAT_MONTH_FIELD = 2,
UDAT_DATE_FIELD = 3,
UDAT_HOUR_OF_DAY1_FIELD = 4,
UDAT_HOUR_OF_DAY0_FIELD = 5,
UDAT_MINUTE_FIELD = 6,
UDAT_SECOND_FIELD = 7,
UDAT_FRACTIONAL_SECOND_FIELD = 8,
UDAT_DAY_OF_WEEK_FIELD = 9,
UDAT_DAY_OF_YEAR_FIELD = 10,
UDAT_DAY_OF_WEEK_IN_MONTH_FIELD = 11,
UDAT_WEEK_OF_YEAR_FIELD = 12,
UDAT_WEEK_OF_MONTH_FIELD = 13,
UDAT_AM_PM_FIELD = 14,
UDAT_HOUR1_FIELD = 15,
UDAT_HOUR0_FIELD = 16,
UDAT_TIMEZONE_FIELD = 17,
UDAT_YEAR_WOY_FIELD = 18,
UDAT_DOW_LOCAL_FIELD = 19,
UDAT_EXTENDED_YEAR_FIELD = 20,
UDAT_JULIAN_DAY_FIELD = 21,
UDAT_MILLISECONDS_IN_DAY_FIELD = 22,
UDAT_TIMEZONE_RFC_FIELD = 23,
UDAT_TIMEZONE_GENERIC_FIELD = 24,
UDAT_STANDALONE_DAY_FIELD = 25,
UDAT_STANDALONE_MONTH_FIELD = 26,
UDAT_QUARTER_FIELD = 27,
UDAT_STANDALONE_QUARTER_FIELD = 28,
UDAT_TIMEZONE_SPECIAL_FIELD = 29,
UDAT_YEAR_NAME_FIELD = 30,
UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD = 31,
UDAT_TIMEZONE_ISO_FIELD = 32,
UDAT_TIMEZONE_ISO_LOCAL_FIELD = 33,
#ifndef U_HIDE_INTERNAL_API
UDAT_RELATED_YEAR_FIELD = 34,
#endif /* U_HIDE_INTERNAL_API */
UDAT_AM_PM_MIDNIGHT_NOON_FIELD = 35,
/* FieldPosition selector for 'B' field alignment.
* Displays flexible day periods, such as "in the morning", if available.
* @stable ICU 57
*/
UDAT_FLEXIBLE_DAY_PERIOD_FIELD = 36,
#ifndef U_HIDE_INTERNAL_API
UDAT_TIME_SEPARATOR_FIELD = 37,
#endif /* U_HIDE_INTERNAL_API */
#ifndef U_HIDE_DEPRECATED_API
UDAT_FIELD_COUNT = 38
#endif /* U_HIDE_DEPRECATED_API */
} UDateFormatField;
#ifndef U_HIDE_INTERNAL_API
#define UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR 0
#endif /* U_HIDE_INTERNAL_API */
U_CAPI UCalendarDateFields U_EXPORT2
udat_toCalendarDateField(UDateFormatField field);
U_CAPI UDateFormat* U_EXPORT2
udat_open(UDateFormatStyle timeStyle,
UDateFormatStyle dateStyle,
const char *locale,
const UChar *tzID,
int32_t tzIDLength,
const UChar *pattern,
int32_t patternLength,
UErrorCode *status);
U_CAPI void U_EXPORT2
udat_close(UDateFormat* format);
typedef enum UDateFormatBooleanAttribute {
UDAT_PARSE_ALLOW_WHITESPACE = 0,
UDAT_PARSE_ALLOW_NUMERIC = 1,
UDAT_PARSE_PARTIAL_LITERAL_MATCH = 2,
UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH = 3,
/* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
* it is needed for layout of DateFormat object. */
#ifndef U_FORCE_HIDE_DEPRECATED_API
UDAT_BOOLEAN_ATTRIBUTE_COUNT = 4
#endif // U_FORCE_HIDE_DEPRECATED_API
} UDateFormatBooleanAttribute;
U_CAPI UBool U_EXPORT2
udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute attr, UErrorCode* status);
U_CAPI void U_EXPORT2
udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBool newValue, UErrorCode* status);
typedef enum UDateFormatHourCycle {
UDAT_HOUR_CYCLE_11,
UDAT_HOUR_CYCLE_12,
UDAT_HOUR_CYCLE_23,
UDAT_HOUR_CYCLE_24
} UDateFormatHourCycle;
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateFormatPointer, UDateFormat, udat_close);
U_NAMESPACE_END
#endif
U_CAPI UDateFormat* U_EXPORT2
udat_clone(const UDateFormat *fmt,
UErrorCode *status);
U_CAPI int32_t U_EXPORT2
udat_format( const UDateFormat* format,
UDate dateToFormat,
UChar* result,
int32_t resultLength,
UFieldPosition* position,
UErrorCode* status);
U_CAPI int32_t U_EXPORT2
udat_formatCalendar( const UDateFormat* format,
UCalendar* calendar,
UChar* result,
int32_t capacity,
UFieldPosition* position,
UErrorCode* status);
U_CAPI int32_t U_EXPORT2
udat_formatForFields( const UDateFormat* format,
UDate dateToFormat,
UChar* result,
int32_t resultLength,
UFieldPositionIterator* fpositer,
UErrorCode* status);
U_CAPI int32_t U_EXPORT2
udat_formatCalendarForFields( const UDateFormat* format,
UCalendar* calendar,
UChar* result,
int32_t capacity,
UFieldPositionIterator* fpositer,
UErrorCode* status);
U_CAPI UDate U_EXPORT2
udat_parse(const UDateFormat* format,
const UChar* text,
int32_t textLength,
int32_t *parsePos,
UErrorCode *status);
U_CAPI void U_EXPORT2
udat_parseCalendar(const UDateFormat* format,
UCalendar* calendar,
const UChar* text,
int32_t textLength,
int32_t *parsePos,
UErrorCode *status);
U_CAPI UBool U_EXPORT2
udat_isLenient(const UDateFormat* fmt);
U_CAPI void U_EXPORT2
udat_setLenient( UDateFormat* fmt,
UBool isLenient);
U_CAPI const UCalendar* U_EXPORT2
udat_getCalendar(const UDateFormat* fmt);
U_CAPI void U_EXPORT2
udat_setCalendar( UDateFormat* fmt,
const UCalendar* calendarToSet);
U_CAPI const UNumberFormat* U_EXPORT2
udat_getNumberFormat(const UDateFormat* fmt);
U_CAPI const UNumberFormat* U_EXPORT2
udat_getNumberFormatForField(const UDateFormat* fmt, UChar field);
U_CAPI void U_EXPORT2
udat_adoptNumberFormatForFields( UDateFormat* fmt,
const UChar* fields,
UNumberFormat* numberFormatToSet,
UErrorCode* status);
U_CAPI void U_EXPORT2
udat_setNumberFormat( UDateFormat* fmt,
const UNumberFormat* numberFormatToSet);
U_CAPI void U_EXPORT2
udat_adoptNumberFormat( UDateFormat* fmt,
UNumberFormat* numberFormatToAdopt);
U_CAPI const char* U_EXPORT2
udat_getAvailable(int32_t localeIndex);
U_CAPI int32_t U_EXPORT2
udat_countAvailable(void);
U_CAPI UDate U_EXPORT2
udat_get2DigitYearStart( const UDateFormat *fmt,
UErrorCode *status);
U_CAPI void U_EXPORT2
udat_set2DigitYearStart( UDateFormat *fmt,
UDate d,
UErrorCode *status);
U_CAPI int32_t U_EXPORT2
udat_toPattern( const UDateFormat *fmt,
UBool localized,
UChar *result,
int32_t resultLength,
UErrorCode *status);
U_CAPI void U_EXPORT2
udat_applyPattern( UDateFormat *format,
UBool localized,
const UChar *pattern,
int32_t patternLength);
typedef enum UDateFormatSymbolType {
UDAT_ERAS,
UDAT_MONTHS,
UDAT_SHORT_MONTHS,
UDAT_WEEKDAYS,
UDAT_SHORT_WEEKDAYS,
UDAT_AM_PMS,
UDAT_LOCALIZED_CHARS,
UDAT_ERA_NAMES,
UDAT_NARROW_MONTHS,
UDAT_NARROW_WEEKDAYS,
UDAT_STANDALONE_MONTHS,
UDAT_STANDALONE_SHORT_MONTHS,
UDAT_STANDALONE_NARROW_MONTHS,
UDAT_STANDALONE_WEEKDAYS,
UDAT_STANDALONE_SHORT_WEEKDAYS,
UDAT_STANDALONE_NARROW_WEEKDAYS,
UDAT_QUARTERS,
UDAT_SHORT_QUARTERS,
UDAT_STANDALONE_QUARTERS,
UDAT_STANDALONE_SHORT_QUARTERS,
UDAT_SHORTER_WEEKDAYS,
UDAT_STANDALONE_SHORTER_WEEKDAYS,
UDAT_CYCLIC_YEARS_WIDE,
UDAT_CYCLIC_YEARS_ABBREVIATED,
UDAT_CYCLIC_YEARS_NARROW,
UDAT_ZODIAC_NAMES_WIDE,
UDAT_ZODIAC_NAMES_ABBREVIATED,
UDAT_ZODIAC_NAMES_NARROW,
UDAT_NARROW_QUARTERS,
UDAT_STANDALONE_NARROW_QUARTERS
} UDateFormatSymbolType;
struct UDateFormatSymbols;
typedef struct UDateFormatSymbols UDateFormatSymbols;
U_CAPI int32_t U_EXPORT2
udat_getSymbols(const UDateFormat *fmt,
UDateFormatSymbolType type,
int32_t symbolIndex,
UChar *result,
int32_t resultLength,
UErrorCode *status);
U_CAPI int32_t U_EXPORT2
udat_countSymbols( const UDateFormat *fmt,
UDateFormatSymbolType type);
U_CAPI void U_EXPORT2
udat_setSymbols( UDateFormat *format,
UDateFormatSymbolType type,
int32_t symbolIndex,
UChar *value,
int32_t valueLength,
UErrorCode *status);
U_CAPI const char* U_EXPORT2
udat_getLocaleByType(const UDateFormat *fmt,
ULocDataLocaleType type,
UErrorCode* status);
U_CAPI void U_EXPORT2
udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status);
U_CAPI UDisplayContext U_EXPORT2
udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* status);
#ifndef U_HIDE_INTERNAL_API
U_CAPI int32_t U_EXPORT2
udat_toPatternRelativeDate(const UDateFormat *fmt,
UChar *result,
int32_t resultLength,
UErrorCode *status);
U_CAPI int32_t U_EXPORT2
udat_toPatternRelativeTime(const UDateFormat *fmt,
UChar *result,
int32_t resultLength,
UErrorCode *status);
U_CAPI void U_EXPORT2
udat_applyPatternRelative(UDateFormat *format,
const UChar *datePattern,
int32_t datePatternLength,
const UChar *timePattern,
int32_t timePatternLength,
UErrorCode *status);
typedef UDateFormat* (U_EXPORT2 *UDateFormatOpener) (UDateFormatStyle timeStyle,
UDateFormatStyle dateStyle,
const char *locale,
const UChar *tzID,
int32_t tzIDLength,
const UChar *pattern,
int32_t patternLength,
UErrorCode *status);
U_CAPI void U_EXPORT2
udat_registerOpener(UDateFormatOpener opener, UErrorCode *status);
U_CAPI UDateFormatOpener U_EXPORT2
udat_unregisterOpener(UDateFormatOpener opener, UErrorCode *status);
#endif /* U_HIDE_INTERNAL_API */
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif
LocalUDateFormatPointer
"Smart pointer" class, closes a UDateFormat via udat_close().
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:550
UFieldPosition
A struct representing a range of text containing a specific field.
Definition: umisc.h:34
ucal.h
C API: Calendar.
UCalendarDateFields
UCalendarDateFields
Possible fields in a UCalendar.
Definition: ucal.h:202
UCalendar
void * UCalendar
A calendar.
Definition: ucal.h:172
UDateFormatOpener
UDateFormat *(* UDateFormatOpener)(UDateFormatStyle timeStyle, UDateFormatStyle dateStyle, const char *locale, const UChar *tzID, int32_t tzIDLength, const UChar *pattern, int32_t patternLength, UErrorCode *status)
Definition: udat.h:1714
udat_parseCalendar
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.
udat_applyPatternRelative
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.
udat_getCalendar
U_CAPI const UCalendar * udat_getCalendar(const UDateFormat *fmt)
Get the UCalendar associated with an UDateFormat.
UDateFormat
void * UDateFormat
A date formatter.
Definition: udat.h:157
udat_isLenient
U_CAPI UBool udat_isLenient(const UDateFormat *fmt)
Determine if an UDateFormat will perform lenient parsing.
udat_formatCalendar
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.
udat_toCalendarDateField
U_CAPI UCalendarDateFields udat_toCalendarDateField(UDateFormatField field)
Maps from a UDateFormatField to the corresponding UCalendarDateFields.
udat_getNumberFormatForField
U_CAPI const UNumberFormat * udat_getNumberFormatForField(const UDateFormat *fmt, UChar field)
Get the UNumberFormat for specific field associated with an UDateFormat.
udat_open
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.
udat_adoptNumberFormatForFields
U_CAPI void udat_adoptNumberFormatForFields(UDateFormat *fmt, const UChar *fields, UNumberFormat *numberFormatToSet, UErrorCode *status)
Set the UNumberFormat for specific field associated with an UDateFormat.
udat_getContext
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...
udat_close
U_CAPI void udat_close(UDateFormat *format)
Close a UDateFormat.
UDateFormatSymbolType
UDateFormatSymbolType
The possible types of date format symbols.
Definition: udat.h:1443
UDAT_ERAS
@ UDAT_ERAS
The era names, for example AD.
Definition: udat.h:1445
UDAT_CYCLIC_YEARS_WIDE
@ UDAT_CYCLIC_YEARS_WIDE
Cyclic year names (only supported for some calendars, and only for FORMAT usage; udat_setSymbols not ...
Definition: udat.h:1505
UDAT_CYCLIC_YEARS_NARROW
@ UDAT_CYCLIC_YEARS_NARROW
Cyclic year names (only supported for some calendars, and only for FORMAT usage; udat_setSymbols not ...
Definition: udat.h:1516
UDAT_NARROW_QUARTERS
@ UDAT_NARROW_QUARTERS
The narrow quarter names, for example 1.
Definition: udat.h:1539
UDAT_STANDALONE_NARROW_WEEKDAYS
@ UDAT_STANDALONE_NARROW_WEEKDAYS
The CLDR-style stand-alone "narrow" weekday names.
Definition: udat.h:1479
UDAT_STANDALONE_NARROW_QUARTERS
@ UDAT_STANDALONE_NARROW_QUARTERS
The narrow standalone quarter names, for example 1.
Definition: udat.h:1545
UDAT_SHORT_QUARTERS
@ UDAT_SHORT_QUARTERS
The short quarter names, for example Q1.
Definition: udat.h:1483
UDAT_STANDALONE_QUARTERS
@ UDAT_STANDALONE_QUARTERS
Standalone context versions of quarters.
Definition: udat.h:1485
UDAT_SHORT_WEEKDAYS
@ UDAT_SHORT_WEEKDAYS
The CLDR-style format "abbreviated" (not "short") weekday names, for example "Mon....
Definition: udat.h:1456
UDAT_ZODIAC_NAMES_NARROW
@ UDAT_ZODIAC_NAMES_NARROW
Calendar zodiac names (only supported for some calendars, and only for FORMAT usage; udat_setSymbols ...
Definition: udat.h:1533
UDAT_NARROW_WEEKDAYS
@ UDAT_NARROW_WEEKDAYS
The CLDR-style format "narrow" weekday names, for example "M".
Definition: udat.h:1466
UDAT_STANDALONE_WEEKDAYS
@ UDAT_STANDALONE_WEEKDAYS
The CLDR-style stand-alone "wide" weekday names.
Definition: udat.h:1472
UDAT_ERA_NAMES
@ UDAT_ERA_NAMES
The long era names, for example Anno Domini.
Definition: udat.h:1462
UDAT_STANDALONE_SHORTER_WEEKDAYS
@ UDAT_STANDALONE_SHORTER_WEEKDAYS
Standalone version of UDAT_SHORTER_WEEKDAYS.
Definition: udat.h:1499
UDAT_WEEKDAYS
@ UDAT_WEEKDAYS
The CLDR-style format "wide" weekday names, for example Monday.
Definition: udat.h:1451
UDAT_QUARTERS
@ UDAT_QUARTERS
The quarters, for example 1st Quarter.
Definition: udat.h:1481
UDAT_LOCALIZED_CHARS
@ UDAT_LOCALIZED_CHARS
The localized characters.
Definition: udat.h:1460
UDAT_SHORTER_WEEKDAYS
@ UDAT_SHORTER_WEEKDAYS
The CLDR-style short weekday names, e.g.
Definition: udat.h:1494
UDAT_ZODIAC_NAMES_ABBREVIATED
@ UDAT_ZODIAC_NAMES_ABBREVIATED
Calendar zodiac names (only supported for some calendars, and only for FORMAT usage)
Definition: udat.h:1527
UDAT_ZODIAC_NAMES_WIDE
@ UDAT_ZODIAC_NAMES_WIDE
Calendar zodiac names (only supported for some calendars, and only for FORMAT usage; udat_setSymbols ...
Definition: udat.h:1522
UDAT_MONTHS
@ UDAT_MONTHS
The month names, for example February.
Definition: udat.h:1447
UDAT_NARROW_MONTHS
@ UDAT_NARROW_MONTHS
The narrow month names, for example F.
Definition: udat.h:1464
UDAT_CYCLIC_YEARS_ABBREVIATED
@ UDAT_CYCLIC_YEARS_ABBREVIATED
Cyclic year names (only supported for some calendars, and only for FORMAT usage)
Definition: udat.h:1510
UDAT_STANDALONE_MONTHS
@ UDAT_STANDALONE_MONTHS
Standalone context versions of months.
Definition: udat.h:1468
UDAT_STANDALONE_SHORT_WEEKDAYS
@ UDAT_STANDALONE_SHORT_WEEKDAYS
The CLDR-style stand-alone "abbreviated" (not "short") weekday names.
Definition: udat.h:1477
UDAT_SHORT_MONTHS
@ UDAT_SHORT_MONTHS
The short month names, for example Feb.
Definition: udat.h:1449
UDAT_AM_PMS
@ UDAT_AM_PMS
The AM/PM names, for example AM.
Definition: udat.h:1458
udat_setNumberFormat
U_CAPI void udat_setNumberFormat(UDateFormat *fmt, const UNumberFormat *numberFormatToSet)
Set the UNumberFormat associated with an UDateFormat.
udat_set2DigitYearStart
U_CAPI void udat_set2DigitYearStart(UDateFormat *fmt, UDate d, UErrorCode *status)
Set the year relative to which all 2-digit years will be interpreted.
udat_formatForFields
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.
udat_parse
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.
udat_setLenient
U_CAPI void udat_setLenient(UDateFormat *fmt, UBool isLenient)
Specify whether an UDateFormat will perform lenient parsing.
udat_countAvailable
U_CAPI int32_t udat_countAvailable(void)
Determine how many locales have date/time formatting patterns available.
udat_unregisterOpener
U_CAPI UDateFormatOpener udat_unregisterOpener(UDateFormatOpener opener, UErrorCode *status)
Un-Register a provider factory.
udat_registerOpener
U_CAPI void udat_registerOpener(UDateFormatOpener opener, UErrorCode *status)
Register a provider factory.
UDateFormatSymbols
struct UDateFormatSymbols UDateFormatSymbols
Date format symbols.
Definition: udat.h:1553
udat_setContext
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...
udat_getNumberFormat
U_CAPI const UNumberFormat * udat_getNumberFormat(const UDateFormat *fmt)
Get the UNumberFormat associated with an UDateFormat.
udat_toPattern
U_CAPI int32_t udat_toPattern(const UDateFormat *fmt, UBool localized, UChar *result, int32_t resultLength, UErrorCode *status)
Extract the pattern from a UDateFormat.
udat_getLocaleByType
U_CAPI const char * udat_getLocaleByType(const UDateFormat *fmt, ULocDataLocaleType type, UErrorCode *status)
Get the locale for this date format object.
udat_format
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.
udat_setBooleanAttribute
U_CAPI void udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBool newValue, UErrorCode *status)
Set a boolean attribute associated with a UDateFormat.
udat_get2DigitYearStart
U_CAPI UDate udat_get2DigitYearStart(const UDateFormat *fmt, UErrorCode *status)
Get the year relative to which all 2-digit years are interpreted.
udat_adoptNumberFormat
U_CAPI void udat_adoptNumberFormat(UDateFormat *fmt, UNumberFormat *numberFormatToAdopt)
Adopt the UNumberFormat associated with an UDateFormat.
udat_countSymbols
U_CAPI int32_t udat_countSymbols(const UDateFormat *fmt, UDateFormatSymbolType type)
Count the number of particular symbols for an UDateFormat.
udat_getAvailable
U_CAPI const char * udat_getAvailable(int32_t localeIndex)
Get a locale for which date/time formatting patterns are available.
udat_toPatternRelativeDate
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.
udat_getSymbols
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.
udat_setSymbols
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.
udat_setCalendar
U_CAPI void udat_setCalendar(UDateFormat *fmt, const UCalendar *calendarToSet)
Set the UCalendar associated with an UDateFormat.
UDateFormatField
UDateFormatField
FieldPosition and UFieldPosition selectors for format fields defined by DateFormat and UDateFormat.
Definition: udat.h:515
UDAT_AM_PM_FIELD
@ UDAT_AM_PM_FIELD
FieldPosition and UFieldPosition selector for 'a' field alignment, corresponding to the UCAL_AM_PM fi...
Definition: udat.h:631
UDAT_TIMEZONE_FIELD
@ UDAT_TIMEZONE_FIELD
FieldPosition and UFieldPosition selector for 'z' field alignment, corresponding to the UCAL_ZONE_OFF...
Definition: udat.h:657
UDAT_DOW_LOCAL_FIELD
@ UDAT_DOW_LOCAL_FIELD
FieldPosition and UFieldPosition selector for 'e' field alignment, corresponding to the UCAL_DOW_LOCA...
Definition: udat.h:671
UDAT_DATE_FIELD
@ UDAT_DATE_FIELD
FieldPosition and UFieldPosition selector for 'd' field alignment, corresponding to the UCAL_DATE fie...
Definition: udat.h:542
UDAT_MONTH_FIELD
@ UDAT_MONTH_FIELD
FieldPosition and UFieldPosition selector for 'M' field alignment, corresponding to the UCAL_MONTH fi...
Definition: udat.h:535
UDAT_JULIAN_DAY_FIELD
@ UDAT_JULIAN_DAY_FIELD
FieldPosition and UFieldPosition selector for 'g' field alignment, corresponding to the UCAL_JULIAN_D...
Definition: udat.h:685
UDAT_FIELD_COUNT
@ UDAT_FIELD_COUNT
Number of FieldPosition and UFieldPosition selectors for DateFormat and UDateFormat.
Definition: udat.h:822
UDAT_EXTENDED_YEAR_FIELD
@ UDAT_EXTENDED_YEAR_FIELD
FieldPosition and UFieldPosition selector for 'u' field alignment, corresponding to the UCAL_EXTENDED...
Definition: udat.h:678
UDAT_RELATED_YEAR_FIELD
@ UDAT_RELATED_YEAR_FIELD
FieldPosition and UFieldPosition selector for 'r' field alignment, no directly corresponding UCAL_ fi...
Definition: udat.h:788
UDAT_DAY_OF_WEEK_FIELD
@ UDAT_DAY_OF_WEEK_FIELD
FieldPosition and UFieldPosition selector for 'E' field alignment, corresponding to the UCAL_DAY_OF_W...
Definition: udat.h:596
UDAT_MILLISECONDS_IN_DAY_FIELD
@ UDAT_MILLISECONDS_IN_DAY_FIELD
FieldPosition and UFieldPosition selector for 'A' field alignment, corresponding to the UCAL_MILLISEC...
Definition: udat.h:692
UDAT_TIMEZONE_SPECIAL_FIELD
@ UDAT_TIMEZONE_SPECIAL_FIELD
FieldPosition and UFieldPosition selector for 'V' field alignment, corresponding to the UCAL_ZONE_OFF...
Definition: udat.h:747
UDAT_YEAR_FIELD
@ UDAT_YEAR_FIELD
FieldPosition and UFieldPosition selector for 'y' field alignment, corresponding to the UCAL_YEAR fie...
Definition: udat.h:528
UDAT_ERA_FIELD
@ UDAT_ERA_FIELD
FieldPosition and UFieldPosition selector for 'G' field alignment, corresponding to the UCAL_ERA fiel...
Definition: udat.h:521
UDAT_STANDALONE_QUARTER_FIELD
@ UDAT_STANDALONE_QUARTER_FIELD
FieldPosition selector for the "q" field alignment, corresponding to stand-alone quarters.
Definition: udat.h:740
UDAT_QUARTER_FIELD
@ UDAT_QUARTER_FIELD
FieldPosition selector for "Q" field alignment, corresponding to quarters.
Definition: udat.h:731
UDAT_TIMEZONE_RFC_FIELD
@ UDAT_TIMEZONE_RFC_FIELD
FieldPosition and UFieldPosition selector for 'Z' field alignment, corresponding to the UCAL_ZONE_OFF...
Definition: udat.h:700
UDAT_DAY_OF_YEAR_FIELD
@ UDAT_DAY_OF_YEAR_FIELD
FieldPosition and UFieldPosition selector for 'D' field alignment, corresponding to the UCAL_DAY_OF_Y...
Definition: udat.h:603
UDAT_WEEK_OF_MONTH_FIELD
@ UDAT_WEEK_OF_MONTH_FIELD
FieldPosition and UFieldPosition selector for 'W' field alignment, corresponding to the UCAL_WEEK_OF_...
Definition: udat.h:624
UDAT_FRACTIONAL_SECOND_FIELD
@ UDAT_FRACTIONAL_SECOND_FIELD
FieldPosition and UFieldPosition selector for 'S' field alignment, corresponding to the UCAL_MILLISEC...
Definition: udat.h:589
UDAT_STANDALONE_DAY_FIELD
@ UDAT_STANDALONE_DAY_FIELD
FieldPosition selector for 'c' field alignment, corresponding to the UCAL_DOW_LOCAL field.
Definition: udat.h:714
UDAT_TIME_SEPARATOR_FIELD
@ UDAT_TIME_SEPARATOR_FIELD
FieldPosition and UFieldPosition selector for time separator, no corresponding UCAL_ field.
Definition: udat.h:812
UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD
@ UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD
FieldPosition selector for 'O' field alignment, corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OF...
Definition: udat.h:764
UDAT_DAY_OF_WEEK_IN_MONTH_FIELD
@ UDAT_DAY_OF_WEEK_IN_MONTH_FIELD
FieldPosition and UFieldPosition selector for 'F' field alignment, corresponding to the UCAL_DAY_OF_W...
Definition: udat.h:610
UDAT_TIMEZONE_ISO_LOCAL_FIELD
@ UDAT_TIMEZONE_ISO_LOCAL_FIELD
FieldPosition selector for 'x' field alignment, corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OF...
Definition: udat.h:780
UDAT_SECOND_FIELD
@ UDAT_SECOND_FIELD
FieldPosition and UFieldPosition selector for 's' field alignment, corresponding to the UCAL_SECOND f...
Definition: udat.h:574
UDAT_HOUR1_FIELD
@ UDAT_HOUR1_FIELD
FieldPosition and UFieldPosition selector for 'h' field alignment, corresponding to the UCAL_HOUR fie...
Definition: udat.h:640
UDAT_YEAR_NAME_FIELD
@ UDAT_YEAR_NAME_FIELD
FieldPosition selector for "U" field alignment, corresponding to cyclic year names.
Definition: udat.h:756
UDAT_AM_PM_MIDNIGHT_NOON_FIELD
@ UDAT_AM_PM_MIDNIGHT_NOON_FIELD
FieldPosition selector for 'b' field alignment.
Definition: udat.h:797
UDAT_MINUTE_FIELD
@ UDAT_MINUTE_FIELD
FieldPosition and UFieldPosition selector for 'm' field alignment, corresponding to the UCAL_MINUTE f...
Definition: udat.h:567
UDAT_TIMEZONE_GENERIC_FIELD
@ UDAT_TIMEZONE_GENERIC_FIELD
FieldPosition and UFieldPosition selector for 'v' field alignment, corresponding to the UCAL_ZONE_OFF...
Definition: udat.h:707
UDAT_HOUR0_FIELD
@ UDAT_HOUR0_FIELD
FieldPosition and UFieldPosition selector for 'K' field alignment, corresponding to the UCAL_HOUR fie...
Definition: udat.h:649
UDAT_YEAR_WOY_FIELD
@ UDAT_YEAR_WOY_FIELD
FieldPosition and UFieldPosition selector for 'Y' field alignment, corresponding to the UCAL_YEAR_WOY...
Definition: udat.h:664
UDAT_WEEK_OF_YEAR_FIELD
@ UDAT_WEEK_OF_YEAR_FIELD
FieldPosition and UFieldPosition selector for 'w' field alignment, corresponding to the UCAL_WEEK_OF_...
Definition: udat.h:617
UDAT_TIMEZONE_ISO_FIELD
@ UDAT_TIMEZONE_ISO_FIELD
FieldPosition selector for 'X' field alignment, corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OF...
Definition: udat.h:772
UDAT_HOUR_OF_DAY0_FIELD
@ UDAT_HOUR_OF_DAY0_FIELD
FieldPosition and UFieldPosition selector for 'H' field alignment, corresponding to the UCAL_HOUR_OF_...
Definition: udat.h:560
UDAT_STANDALONE_MONTH_FIELD
@ UDAT_STANDALONE_MONTH_FIELD
FieldPosition selector for 'L' field alignment, corresponding to the UCAL_MONTH field.
Definition: udat.h:722
UDAT_HOUR_OF_DAY1_FIELD
@ UDAT_HOUR_OF_DAY1_FIELD
FieldPosition and UFieldPosition selector for 'k' field alignment, corresponding to the UCAL_HOUR_OF_...
Definition: udat.h:551
UDateFormatStyle
UDateFormatStyle
The possible date/time format styles.
Definition: udat.h:162
UDAT_PATTERN
@ UDAT_PATTERN
Use the pattern given in the parameter to udat_open.
Definition: udat.h:194
UDAT_RELATIVE
@ UDAT_RELATIVE
Bitfield for relative date.
Definition: udat.h:175
UDAT_DEFAULT
@ UDAT_DEFAULT
Default style.
Definition: udat.h:172
UDAT_IGNORE
@ UDAT_IGNORE
Definition: udat.h:198
UDAT_SHORT
@ UDAT_SHORT
Short style.
Definition: udat.h:170
UDAT_FULL
@ UDAT_FULL
Full style.
Definition: udat.h:164
UDAT_LONG
@ UDAT_LONG
Long style.
Definition: udat.h:166
UDAT_MEDIUM
@ UDAT_MEDIUM
Medium style.
Definition: udat.h:168
UDAT_NONE
@ UDAT_NONE
No style.
Definition: udat.h:187
UDateFormatHourCycle
UDateFormatHourCycle
Hour Cycle.
Definition: udat.h:983
UDAT_HOUR_CYCLE_11
@ UDAT_HOUR_CYCLE_11
Hour in am/pm (0~11)
Definition: udat.h:988
UDAT_HOUR_CYCLE_23
@ UDAT_HOUR_CYCLE_23
Hour in day (0~23)
Definition: udat.h:1000
UDAT_HOUR_CYCLE_24
@ UDAT_HOUR_CYCLE_24
Hour in day (1~24)
Definition: udat.h:1006
UDAT_HOUR_CYCLE_12
@ UDAT_HOUR_CYCLE_12
Hour in am/pm (1~12)
Definition: udat.h:994
udat_clone
U_CAPI UDateFormat * udat_clone(const UDateFormat *fmt, UErrorCode *status)
Open a copy of a UDateFormat.
udat_getBooleanAttribute
U_CAPI UBool udat_getBooleanAttribute(const UDateFormat *fmt, UDateFormatBooleanAttribute attr, UErrorCode *status)
Get a boolean attribute associated with a UDateFormat.
udat_formatCalendarForFields
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.
udat_applyPattern
U_CAPI void udat_applyPattern(UDateFormat *format, UBool localized, const UChar *pattern, int32_t patternLength)
Set the pattern used by an UDateFormat.
udat_toPatternRelativeTime
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
UDateFormatBooleanAttribute
DateFormat boolean attributes.
Definition: udat.h:917
UDAT_PARSE_ALLOW_WHITESPACE
@ UDAT_PARSE_ALLOW_WHITESPACE
indicates whether whitespace is allowed.
Definition: udat.h:922
UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH
@ UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH
indicates tolerance of pattern mismatch between input data and specified format pattern.
Definition: udat.h:940
UDAT_BOOLEAN_ATTRIBUTE_COUNT
@ UDAT_BOOLEAN_ATTRIBUTE_COUNT
One more than the highest normal UDateFormatBooleanAttribute value.
Definition: udat.h:949
UDAT_PARSE_PARTIAL_LITERAL_MATCH
@ UDAT_PARSE_PARTIAL_LITERAL_MATCH
indicates tolerance of a partial literal match e.g.
Definition: udat.h:934
UDAT_PARSE_ALLOW_NUMERIC
@ UDAT_PARSE_ALLOW_NUMERIC
indicates tolerance of numeric data when String data may be assumed.
Definition: udat.h:928
udisplaycontext.h
C API: Display context types (enum values)
UDisplayContextType
UDisplayContextType
Display context types, for getting values of a particular setting.
Definition: udisplaycontext.h:27
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:64
ufieldpositer.h
C API: UFieldPositionIterator for use with format APIs.
UFieldPositionIterator
struct UFieldPositionIterator UFieldPositionIterator
C typedef for struct UFieldPositionIterator.
Definition: ufieldpositer.h:46
ULocDataLocaleType
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested,...
Definition: uloc.h:338
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:247
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
UChar
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:386
unum.h
C API: Compatibility APIs for number formatting.
UNumberFormat
void * UNumberFormat
A number formatter.
Definition: unum.h:145
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
U_HIDE_INTERNAL_API
#define U_HIDE_INTERNAL_API
Define this to 1 to request that internal API be "hidden".
Definition: utypes.h:87
UDate
double UDate
Date and Time data type.
Definition: utypes.h:203