ICU 78.2 78.2

udat.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *******************************************************************************
5 * Copyright (C) 1996-2016, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 *******************************************************************************
8 */
9
10 #ifndef UDAT_H
11 #define UDAT_H
12
13 #include "unicode/utypes.h"
14
15 #if !UCONFIG_NO_FORMATTING
16
17 #include "unicode/ucal.h"
18 #include "unicode/unum.h"
19 #include "unicode/udisplaycontext.h"
20 #include "unicode/ufieldpositer.h"
21
22 #if U_SHOW_CPLUSPLUS_API
23 #include "unicode/localpointer.h"
24 #endif // U_SHOW_CPLUSPLUS_API
25
157 typedef void* UDateFormat;
158
162 typedef enum UDateFormatStyle {
164 UDAT_FULL,
166 UDAT_LONG,
168 UDAT_MEDIUM,
170 UDAT_SHORT,
172 UDAT_DEFAULT = UDAT_MEDIUM,
173
175 UDAT_RELATIVE = (1 << 7),
176
177 UDAT_FULL_RELATIVE = UDAT_FULL | UDAT_RELATIVE,
178
179 UDAT_LONG_RELATIVE = UDAT_LONG | UDAT_RELATIVE,
180
181 UDAT_MEDIUM_RELATIVE = UDAT_MEDIUM | UDAT_RELATIVE,
182
183 UDAT_SHORT_RELATIVE = UDAT_SHORT | UDAT_RELATIVE,
184
185
187 UDAT_NONE = -1,
188
194 UDAT_PATTERN = -2,
195
196 #ifndef U_HIDE_INTERNAL_API
198 UDAT_IGNORE = UDAT_PATTERN
199 #endif /* U_HIDE_INTERNAL_API */
200 } UDateFormatStyle;
201
202 /* Skeletons for dates. */
203
208 #define UDAT_YEAR "y"
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"
263 #define UDAT_DAY "d"
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"
346
347 /* Skeletons for times. */
348
353 #define UDAT_HOUR "j"
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"
401
402 /* Skeletons for time zones. */
403
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"
452
453 /* deprecated skeleton constants */
454
455 #ifndef U_HIDE_DEPRECATED_API
460 #define UDAT_STANDALONE_MONTH "LLLL"
465 #define UDAT_ABBR_STANDALONE_MONTH "LLL"
466
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"
487 #endif /* U_HIDE_DEPRECATED_API */
488
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"
508 #endif // U_HIDE_INTERNAL_API
509
515 typedef enum UDateFormatField {
521 UDAT_ERA_FIELD = 0,
522
528 UDAT_YEAR_FIELD = 1,
529
535 UDAT_MONTH_FIELD = 2,
536
542 UDAT_DATE_FIELD = 3,
543
551 UDAT_HOUR_OF_DAY1_FIELD = 4,
552
560 UDAT_HOUR_OF_DAY0_FIELD = 5,
561
567 UDAT_MINUTE_FIELD = 6,
568
574 UDAT_SECOND_FIELD = 7,
575
589 UDAT_FRACTIONAL_SECOND_FIELD = 8,
590
596 UDAT_DAY_OF_WEEK_FIELD = 9,
597
603 UDAT_DAY_OF_YEAR_FIELD = 10,
604
610 UDAT_DAY_OF_WEEK_IN_MONTH_FIELD = 11,
611
617 UDAT_WEEK_OF_YEAR_FIELD = 12,
618
624 UDAT_WEEK_OF_MONTH_FIELD = 13,
625
631 UDAT_AM_PM_FIELD = 14,
632
640 UDAT_HOUR1_FIELD = 15,
641
649 UDAT_HOUR0_FIELD = 16,
650
657 UDAT_TIMEZONE_FIELD = 17,
658
664 UDAT_YEAR_WOY_FIELD = 18,
665
671 UDAT_DOW_LOCAL_FIELD = 19,
672
678 UDAT_EXTENDED_YEAR_FIELD = 20,
679
685 UDAT_JULIAN_DAY_FIELD = 21,
686
692 UDAT_MILLISECONDS_IN_DAY_FIELD = 22,
693
700 UDAT_TIMEZONE_RFC_FIELD = 23,
701
707 UDAT_TIMEZONE_GENERIC_FIELD = 24,
714 UDAT_STANDALONE_DAY_FIELD = 25,
715
722 UDAT_STANDALONE_MONTH_FIELD = 26,
723
731 UDAT_QUARTER_FIELD = 27,
732
740 UDAT_STANDALONE_QUARTER_FIELD = 28,
741
747 UDAT_TIMEZONE_SPECIAL_FIELD = 29,
748
756 UDAT_YEAR_NAME_FIELD = 30,
757
764 UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD = 31,
765
772 UDAT_TIMEZONE_ISO_FIELD = 32,
773
780 UDAT_TIMEZONE_ISO_LOCAL_FIELD = 33,
781
782 #ifndef U_HIDE_INTERNAL_API
788 UDAT_RELATED_YEAR_FIELD = 34,
789 #endif /* U_HIDE_INTERNAL_API */
790
797 UDAT_AM_PM_MIDNIGHT_NOON_FIELD = 35,
798
799 /* FieldPosition selector for 'B' field alignment.
800 * Displays flexible day periods, such as "in the morning", if available.
801 * @stable ICU 57
802 */
803 UDAT_FLEXIBLE_DAY_PERIOD_FIELD = 36,
804
805 #ifndef U_HIDE_INTERNAL_API
812 UDAT_TIME_SEPARATOR_FIELD = 37,
813 #endif /* U_HIDE_INTERNAL_API */
814
815 #ifndef U_HIDE_DEPRECATED_API
822 UDAT_FIELD_COUNT = 38
823 #endif /* U_HIDE_DEPRECATED_API */
824 } UDateFormatField;
825
826
827 #ifndef U_HIDE_INTERNAL_API
833 #define UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR 0
834 #endif /* U_HIDE_INTERNAL_API */
835
836
859 U_CAPI UCalendarDateFields U_EXPORT2
860 udat_toCalendarDateField(UDateFormatField field);
861
862
891 U_CAPI UDateFormat* U_EXPORT2
892 udat_open(UDateFormatStyle timeStyle,
893 UDateFormatStyle dateStyle,
894 const char *locale,
895 const UChar *tzID,
896 int32_t tzIDLength,
897 const UChar *pattern,
898 int32_t patternLength,
899 UErrorCode *status);
900
901
908 U_CAPI void U_EXPORT2
909 udat_close(UDateFormat* format);
910
911
917 typedef enum UDateFormatBooleanAttribute {
922 UDAT_PARSE_ALLOW_WHITESPACE = 0,
928 UDAT_PARSE_ALLOW_NUMERIC = 1,
934 UDAT_PARSE_PARTIAL_LITERAL_MATCH = 2,
940 UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH = 3,
941
942 /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
943 * it is needed for layout of DateFormat object. */
944 #ifndef U_FORCE_HIDE_DEPRECATED_API
949 UDAT_BOOLEAN_ATTRIBUTE_COUNT = 4
950 #endif // U_FORCE_HIDE_DEPRECATED_API
951 } UDateFormatBooleanAttribute;
952
963 U_CAPI UBool U_EXPORT2
964 udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute attr, UErrorCode* status);
965
976 U_CAPI void U_EXPORT2
977 udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBool newValue, UErrorCode* status);
978
983 typedef enum UDateFormatHourCycle {
988 UDAT_HOUR_CYCLE_11,
989
994 UDAT_HOUR_CYCLE_12,
995
1000 UDAT_HOUR_CYCLE_23,
1001
1006 UDAT_HOUR_CYCLE_24
1007 } UDateFormatHourCycle;
1008
1009 #if U_SHOW_CPLUSPLUS_API
1010
1011 U_NAMESPACE_BEGIN
1012
1022 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateFormatPointer, UDateFormat, udat_close);
1023
1024 U_NAMESPACE_END
1025
1026 #endif
1027
1036 U_CAPI UDateFormat* U_EXPORT2
1037 udat_clone(const UDateFormat *fmt,
1038 UErrorCode *status);
1039
1058 U_CAPI int32_t U_EXPORT2
1059 udat_format( const UDateFormat* format,
1060 UDate dateToFormat,
1061 UChar* result,
1062 int32_t resultLength,
1063 UFieldPosition* position,
1064 UErrorCode* status);
1065
1088 U_CAPI int32_t U_EXPORT2
1089 udat_formatCalendar( const UDateFormat* format,
1090 UCalendar* calendar,
1091 UChar* result,
1092 int32_t capacity,
1093 UFieldPosition* position,
1094 UErrorCode* status);
1095
1123 U_CAPI int32_t U_EXPORT2
1124 udat_formatForFields( const UDateFormat* format,
1125 UDate dateToFormat,
1126 UChar* result,
1127 int32_t resultLength,
1128 UFieldPositionIterator* fpositer,
1129 UErrorCode* status);
1130
1161 U_CAPI int32_t U_EXPORT2
1162 udat_formatCalendarForFields( const UDateFormat* format,
1163 UCalendar* calendar,
1164 UChar* result,
1165 int32_t capacity,
1166 UFieldPositionIterator* fpositer,
1167 UErrorCode* status);
1168
1169
1195 U_CAPI UDate U_EXPORT2
1196 udat_parse(const UDateFormat* format,
1197 const UChar* text,
1198 int32_t textLength,
1199 int32_t *parsePos,
1200 UErrorCode *status);
1201
1223 U_CAPI void U_EXPORT2
1224 udat_parseCalendar(const UDateFormat* format,
1225 UCalendar* calendar,
1226 const UChar* text,
1227 int32_t textLength,
1228 int32_t *parsePos,
1229 UErrorCode *status);
1230
1240 U_CAPI UBool U_EXPORT2
1241 udat_isLenient(const UDateFormat* fmt);
1242
1252 U_CAPI void U_EXPORT2
1253 udat_setLenient( UDateFormat* fmt,
1254 UBool isLenient);
1255
1265 U_CAPI const UCalendar* U_EXPORT2
1266 udat_getCalendar(const UDateFormat* fmt);
1267
1277 U_CAPI void U_EXPORT2
1278 udat_setCalendar( UDateFormat* fmt,
1279 const UCalendar* calendarToSet);
1280
1290 U_CAPI const UNumberFormat* U_EXPORT2
1291 udat_getNumberFormat(const UDateFormat* fmt);
1292
1302 U_CAPI const UNumberFormat* U_EXPORT2
1303 udat_getNumberFormatForField(const UDateFormat* fmt, UChar field);
1304
1320 U_CAPI void U_EXPORT2
1321 udat_adoptNumberFormatForFields( UDateFormat* fmt,
1322 const UChar* fields,
1323 UNumberFormat* numberFormatToSet,
1324 UErrorCode* status);
1337 U_CAPI void U_EXPORT2
1338 udat_setNumberFormat( UDateFormat* fmt,
1339 const UNumberFormat* numberFormatToSet);
1349 U_CAPI void U_EXPORT2
1350 udat_adoptNumberFormat( UDateFormat* fmt,
1351 UNumberFormat* numberFormatToAdopt);
1361 U_CAPI const char* U_EXPORT2
1362 udat_getAvailable(int32_t localeIndex);
1363
1372 U_CAPI int32_t U_EXPORT2
1373 udat_countAvailable(void);
1374
1385 U_CAPI UDate U_EXPORT2
1386 udat_get2DigitYearStart( const UDateFormat *fmt,
1387 UErrorCode *status);
1388
1399 U_CAPI void U_EXPORT2
1400 udat_set2DigitYearStart( UDateFormat *fmt,
1401 UDate d,
1402 UErrorCode *status);
1403
1416 U_CAPI int32_t U_EXPORT2
1417 udat_toPattern( const UDateFormat *fmt,
1418 UBool localized,
1419 UChar *result,
1420 int32_t resultLength,
1421 UErrorCode *status);
1422
1433 U_CAPI void U_EXPORT2
1434 udat_applyPattern( UDateFormat *format,
1435 UBool localized,
1436 const UChar *pattern,
1437 int32_t patternLength);
1438
1443 typedef enum UDateFormatSymbolType {
1445 UDAT_ERAS,
1447 UDAT_MONTHS,
1449 UDAT_SHORT_MONTHS,
1451 UDAT_WEEKDAYS,
1456 UDAT_SHORT_WEEKDAYS,
1458 UDAT_AM_PMS,
1460 UDAT_LOCALIZED_CHARS,
1462 UDAT_ERA_NAMES,
1464 UDAT_NARROW_MONTHS,
1466 UDAT_NARROW_WEEKDAYS,
1468 UDAT_STANDALONE_MONTHS,
1469 UDAT_STANDALONE_SHORT_MONTHS,
1470 UDAT_STANDALONE_NARROW_MONTHS,
1472 UDAT_STANDALONE_WEEKDAYS,
1477 UDAT_STANDALONE_SHORT_WEEKDAYS,
1479 UDAT_STANDALONE_NARROW_WEEKDAYS,
1481 UDAT_QUARTERS,
1483 UDAT_SHORT_QUARTERS,
1485 UDAT_STANDALONE_QUARTERS,
1486 UDAT_STANDALONE_SHORT_QUARTERS,
1494 UDAT_SHORTER_WEEKDAYS,
1499 UDAT_STANDALONE_SHORTER_WEEKDAYS,
1505 UDAT_CYCLIC_YEARS_WIDE,
1510 UDAT_CYCLIC_YEARS_ABBREVIATED,
1516 UDAT_CYCLIC_YEARS_NARROW,
1522 UDAT_ZODIAC_NAMES_WIDE,
1527 UDAT_ZODIAC_NAMES_ABBREVIATED,
1533 UDAT_ZODIAC_NAMES_NARROW,
1534
1539 UDAT_NARROW_QUARTERS,
1540
1545 UDAT_STANDALONE_NARROW_QUARTERS,
1546
1547 #ifndef U_HIDE_DRAFT_API
1552 UDAT_AM_PMS_NARROW,
1553
1558 UDAT_AM_PMS_WIDE,
1559 #endif /* U_HIDE_DRAFT_API */
1560 } UDateFormatSymbolType;
1561
1562 struct UDateFormatSymbols;
1567 typedef struct UDateFormatSymbols UDateFormatSymbols;
1568
1585 U_CAPI int32_t U_EXPORT2
1586 udat_getSymbols(const UDateFormat *fmt,
1587 UDateFormatSymbolType type,
1588 int32_t symbolIndex,
1589 UChar *result,
1590 int32_t resultLength,
1591 UErrorCode *status);
1592
1605 U_CAPI int32_t U_EXPORT2
1606 udat_countSymbols( const UDateFormat *fmt,
1607 UDateFormatSymbolType type);
1608
1624 U_CAPI void U_EXPORT2
1625 udat_setSymbols( UDateFormat *format,
1626 UDateFormatSymbolType type,
1627 int32_t symbolIndex,
1628 UChar *value,
1629 int32_t valueLength,
1630 UErrorCode *status);
1631
1641 U_CAPI const char* U_EXPORT2
1642 udat_getLocaleByType(const UDateFormat *fmt,
1643 ULocDataLocaleType type,
1644 UErrorCode* status);
1645
1654 U_CAPI void U_EXPORT2
1655 udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status);
1656
1666 U_CAPI UDisplayContext U_EXPORT2
1667 udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* status);
1668
1669 #ifndef U_HIDE_INTERNAL_API
1681 U_CAPI int32_t U_EXPORT2
1682 udat_toPatternRelativeDate(const UDateFormat *fmt,
1683 UChar *result,
1684 int32_t resultLength,
1685 UErrorCode *status);
1686
1698 U_CAPI int32_t U_EXPORT2
1699 udat_toPatternRelativeTime(const UDateFormat *fmt,
1700 UChar *result,
1701 int32_t resultLength,
1702 UErrorCode *status);
1703
1716 U_CAPI void U_EXPORT2
1717 udat_applyPatternRelative(UDateFormat *format,
1718 const UChar *datePattern,
1719 int32_t datePatternLength,
1720 const UChar *timePattern,
1721 int32_t timePatternLength,
1722 UErrorCode *status);
1723
1728 typedef UDateFormat* (U_EXPORT2 *UDateFormatOpener) (UDateFormatStyle timeStyle,
1729 UDateFormatStyle dateStyle,
1730 const char *locale,
1731 const UChar *tzID,
1732 int32_t tzIDLength,
1733 const UChar *pattern,
1734 int32_t patternLength,
1735 UErrorCode *status);
1736
1741 U_CAPI void U_EXPORT2
1742 udat_registerOpener(UDateFormatOpener opener, UErrorCode *status);
1743
1748 U_CAPI UDateFormatOpener U_EXPORT2
1749 udat_unregisterOpener(UDateFormatOpener opener, UErrorCode *status);
1750 #endif /* U_HIDE_INTERNAL_API */
1751
1752
1753 #endif /* #if !UCONFIG_NO_FORMATTING */
1754
1755 #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:548
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:1728
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_AM_PMS_WIDE
@ UDAT_AM_PMS_WIDE
Wide AM/PM names.
Definition: udat.h:1558
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_AM_PMS_NARROW
@ UDAT_AM_PMS_NARROW
Narrow AM/PM names.
Definition: udat.h:1552
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:1567
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:269
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:400
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:509
U_HIDE_INTERNAL_API
#define U_HIDE_INTERNAL_API
Define this to 1 to request that internal API be "hidden".
Definition: utypes.h:102
UDate
double UDate
Date and Time data type.
Definition: utypes.h:218