2 *******************************************************************************
3 * Copyright (C) 1996-2006, International Business Machines Corporation and others.
5 *******************************************************************************
11 #include "unicode/utypes.h"
13 #if !UCONFIG_NO_FORMATTING
15 #include "unicode/ucal.h"
16 #include "unicode/unum.h"
19 * \brief C API: DateFormat
21 * <h2> Date Format C API</h2>
23 * Date Format C API consists of functions that convert dates and
24 * times from their internal representations to textual form and back again in a
25 * language-independent manner. Converting from the internal representation (milliseconds
26 * since midnight, January 1, 1970) to text is known as "formatting," and converting
27 * from text to millis is known as "parsing." We currently define only one concrete
28 * structure UDateFormat, which can handle pretty much all normal
29 * date formatting and parsing actions.
31 * Date Format helps you to format and parse dates for any locale. Your code can
32 * be completely independent of the locale conventions for months, days of the
33 * week, or even the calendar format: lunar vs. solar.
35 * To format a date for the current Locale with default time and date style,
36 * use one of the static factory methods:
39 * UErrorCode status = U_ZERO_ERROR;
41 * int32_t myStrlen = 0;
42 * UDateFormat* dfmt = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, NULL, NULL, -1, NULL, -1, &status);
43 * myStrlen = udat_format(dfmt, myDate, NULL, myStrlen, NULL, &status);
44 * if (status==U_BUFFER_OVERFLOW_ERROR){
45 * status=U_ZERO_ERROR;
46 * myString=(UChar*)malloc(sizeof(UChar) * (myStrlen+1) );
47 * udat_format(dfmt, myDate, myString, myStrlen+1, NULL, &status);
51 * If you are formatting multiple numbers, it is more efficient to get the
52 * format and use it multiple times so that the system doesn't have to fetch the
53 * information about the local language and country conventions multiple times.
56 * UErrorCode status = U_ZERO_ERROR;
57 * int32_t i, myStrlen = 0;
60 * UDate myDateArr[] = { 0.0, 100000000.0, 2000000000.0 }; // test values
61 * UDateFormat* df = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, NULL, NULL, -1, NULL, 0, &status);
62 * for (i = 0; i < 3; i++) {
63 * myStrlen = udat_format(df, myDateArr[i], NULL, myStrlen, NULL, &status);
64 * if(status == U_BUFFER_OVERFLOW_ERROR){
65 * status = U_ZERO_ERROR;
66 * myString = (UChar*)malloc(sizeof(UChar) * (myStrlen+1) );
67 * udat_format(df, myDateArr[i], myString, myStrlen+1, NULL, &status);
68 * printf("%s\n", u_austrcpy(buffer, myString) );
74 * To get specific fields of a date, you can use UFieldPosition to
75 * get specific fields.
78 * UErrorCode status = U_ZERO_ERROR;
81 * int32_t myStrlen = 0;
84 * pos.field = 1; // Same as the DateFormat::EField enum
85 * UDateFormat* dfmt = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, NULL, -1, NULL, 0, &status);
86 * myStrlen = udat_format(dfmt, myDate, NULL, myStrlen, &pos, &status);
87 * if (status==U_BUFFER_OVERFLOW_ERROR){
88 * status=U_ZERO_ERROR;
89 * myString=(UChar*)malloc(sizeof(UChar) * (myStrlen+1) );
90 * udat_format(dfmt, myDate, myString, myStrlen+1, &pos, &status);
92 * printf("date format: %s\n", u_austrcpy(buffer, myString));
93 * buffer[pos.endIndex] = 0; // NULL terminate the string.
94 * printf("UFieldPosition position equals %s\n", &buffer[pos.beginIndex]);
97 * To format a date for a different Locale, specify it in the call to
101 * UDateFormat* df = udat_open(UDAT_SHORT, UDAT_SHORT, "fr_FR", NULL, -1, NULL, 0, &status);
104 * You can use a DateFormat API udat_parse() to parse.
107 * UErrorCode status = U_ZERO_ERROR;
108 * int32_t parsepos=0;
109 * UDate myDate = udat_parse(df, myString, u_strlen(myString), &parsepos, &status);
112 * You can pass in different options for the arguments for date and time style
113 * to control the length of the result; from SHORT to MEDIUM to LONG to FULL.
114 * The exact result depends on the locale, but generally:
115 * see UDateFormatStyle for more details
117 * <li> UDAT_SHORT is completely numeric, such as 12/13/52 or 3:30pm
118 * <li> UDAT_MEDIUM is longer, such as Jan 12, 1952
119 * <li> UDAT_LONG is longer, such as January 12, 1952 or 3:30:32pm
120 * <li> UDAT_FULL is pretty completely specified, such as
121 * Tuesday, April 12, 1952 AD or 3:30:42pm PST.
123 * You can also set the time zone on the format if you wish.
125 * You can also use forms of the parse and format methods with Parse Position and
126 * UFieldPosition to allow you to
128 * <li> Progressively parse through pieces of a string.
129 * <li> Align any particular field, or find out where it is for selection
134 /** A date formatter.
135 * For usage in C programs.
138 typedef void* UDateFormat
;
140 /** The possible date/time format styles
143 typedef enum UDateFormatStyle
{
153 UDAT_DEFAULT
= UDAT_MEDIUM
,
156 /** for internal API use only */
162 * FieldPosition and UFieldPosition selectors for format fields
163 * defined by DateFormat and UDateFormat.
166 typedef enum UDateFormatField
{
168 * FieldPosition and UFieldPosition selector for 'G' field alignment,
169 * corresponding to the UCAL_ERA field.
175 * FieldPosition and UFieldPosition selector for 'y' field alignment,
176 * corresponding to the UCAL_YEAR field.
182 * FieldPosition and UFieldPosition selector for 'M' field alignment,
183 * corresponding to the UCAL_MONTH field.
186 UDAT_MONTH_FIELD
= 2,
189 * FieldPosition and UFieldPosition selector for 'd' field alignment,
190 * corresponding to the UCAL_DATE field.
196 * FieldPosition and UFieldPosition selector for 'k' field alignment,
197 * corresponding to the UCAL_HOUR_OF_DAY field.
198 * UDAT_HOUR_OF_DAY1_FIELD is used for the one-based 24-hour clock.
199 * For example, 23:59 + 01:00 results in 24:59.
202 UDAT_HOUR_OF_DAY1_FIELD
= 4,
205 * FieldPosition and UFieldPosition selector for 'H' field alignment,
206 * corresponding to the UCAL_HOUR_OF_DAY field.
207 * UDAT_HOUR_OF_DAY0_FIELD is used for the zero-based 24-hour clock.
208 * For example, 23:59 + 01:00 results in 00:59.
211 UDAT_HOUR_OF_DAY0_FIELD
= 5,
214 * FieldPosition and UFieldPosition selector for 'm' field alignment,
215 * corresponding to the UCAL_MINUTE field.
218 UDAT_MINUTE_FIELD
= 6,
221 * FieldPosition and UFieldPosition selector for 's' field alignment,
222 * corresponding to the UCAL_SECOND field.
225 UDAT_SECOND_FIELD
= 7,
228 * FieldPosition and UFieldPosition selector for 'S' field alignment,
229 * corresponding to the UCAL_MILLISECOND field.
232 UDAT_FRACTIONAL_SECOND_FIELD
= 8,
235 * FieldPosition and UFieldPosition selector for 'E' field alignment,
236 * corresponding to the UCAL_DAY_OF_WEEK field.
239 UDAT_DAY_OF_WEEK_FIELD
= 9,
242 * FieldPosition and UFieldPosition selector for 'D' field alignment,
243 * corresponding to the UCAL_DAY_OF_YEAR field.
246 UDAT_DAY_OF_YEAR_FIELD
= 10,
249 * FieldPosition and UFieldPosition selector for 'F' field alignment,
250 * corresponding to the UCAL_DAY_OF_WEEK_IN_MONTH field.
253 UDAT_DAY_OF_WEEK_IN_MONTH_FIELD
= 11,
256 * FieldPosition and UFieldPosition selector for 'w' field alignment,
257 * corresponding to the UCAL_WEEK_OF_YEAR field.
260 UDAT_WEEK_OF_YEAR_FIELD
= 12,
263 * FieldPosition and UFieldPosition selector for 'W' field alignment,
264 * corresponding to the UCAL_WEEK_OF_MONTH field.
267 UDAT_WEEK_OF_MONTH_FIELD
= 13,
270 * FieldPosition and UFieldPosition selector for 'a' field alignment,
271 * corresponding to the UCAL_AM_PM field.
274 UDAT_AM_PM_FIELD
= 14,
277 * FieldPosition and UFieldPosition selector for 'h' field alignment,
278 * corresponding to the UCAL_HOUR field.
279 * UDAT_HOUR1_FIELD is used for the one-based 12-hour clock.
280 * For example, 11:30 PM + 1 hour results in 12:30 AM.
283 UDAT_HOUR1_FIELD
= 15,
286 * FieldPosition and UFieldPosition selector for 'K' field alignment,
287 * corresponding to the UCAL_HOUR field.
288 * UDAT_HOUR0_FIELD is used for the zero-based 12-hour clock.
289 * For example, 11:30 PM + 1 hour results in 00:30 AM.
292 UDAT_HOUR0_FIELD
= 16,
295 * FieldPosition and UFieldPosition selector for 'z' field alignment,
296 * corresponding to the UCAL_ZONE_OFFSET and
297 * UCAL_DST_OFFSET fields.
300 UDAT_TIMEZONE_FIELD
= 17,
303 * FieldPosition and UFieldPosition selector for 'Y' field alignment,
304 * corresponding to the UCAL_YEAR_WOY field.
307 UDAT_YEAR_WOY_FIELD
= 18,
310 * FieldPosition and UFieldPosition selector for 'e' field alignment,
311 * corresponding to the UCAL_DOW_LOCAL field.
314 UDAT_DOW_LOCAL_FIELD
= 19,
317 * FieldPosition and UFieldPosition selector for 'u' field alignment,
318 * corresponding to the UCAL_EXTENDED_YEAR field.
321 UDAT_EXTENDED_YEAR_FIELD
= 20,
324 * FieldPosition and UFieldPosition selector for 'g' field alignment,
325 * corresponding to the UCAL_JULIAN_DAY field.
328 UDAT_JULIAN_DAY_FIELD
= 21,
331 * FieldPosition and UFieldPosition selector for 'A' field alignment,
332 * corresponding to the UCAL_MILLISECONDS_IN_DAY field.
335 UDAT_MILLISECONDS_IN_DAY_FIELD
= 22,
338 * FieldPosition and UFieldPosition selector for 'Z' field alignment,
339 * corresponding to the UCAL_ZONE_OFFSET and
340 * UCAL_DST_OFFSET fields.
343 UDAT_TIMEZONE_RFC_FIELD
= 23,
345 #ifndef U_HIDE_DRAFT_API
348 * FieldPosition and UFieldPosition selector for 'v' field alignment,
349 * corresponding to the UCAL_ZONE_OFFSET field.
352 UDAT_TIMEZONE_GENERIC_FIELD
= 24,
354 * FieldPosition selector for 'c' field alignment,
355 * corresponding to the {@link Calendar#DAY} field.
356 * This displays the stand alone day name, if available.
359 UDAT_STANDALONE_DAY_FIELD
= 25,
362 * FieldPosition selector for 'L' field alignment,
363 * corresponding to the {@link Calendar#MONTH} field.
364 * This displays the stand alone month name, if available.
367 UDAT_STANDALONE_MONTH_FIELD
= 26,
370 * FieldPosition selector for "Q" field alignment,
371 * corresponding to quarters. This is implemented
372 * using the {@link Calendar#MONTH} field. This
373 * displays the quarter.
376 UDAT_QUARTER_FIELD
= 27,
379 * FieldPosition selector for the "q" field alignment,
380 * corresponding to stand-alone quarters. This is
381 * implemented using the {@link Calendar#MONTH} field.
382 * This displays the stand-alone quarter.
385 UDAT_STANDALONE_QUARTER_FIELD
= 28,
387 #endif /*U_HIDE_DRAFT_API*/
390 * Number of FieldPosition and UFieldPosition selectors for
391 * DateFormat and UDateFormat.
392 * Valid selectors range from 0 to UDAT_FIELD_COUNT-1.
393 * This value is subject to change if new fields are defined
397 UDAT_FIELD_COUNT
= 29
402 * Open a new UDateFormat for formatting and parsing dates and times.
403 * A UDateFormat may be used to format dates in calls to {@link #udat_format },
404 * and to parse dates in calls to {@link #udat_parse }.
405 * @param timeStyle The style used to format times; one of UDAT_FULL, UDAT_LONG,
406 * UDAT_MEDIUM, UDAT_SHORT, or UDAT_DEFAULT
407 * @param dateStyle The style used to format dates; one of UDAT_FULL, UDAT_LONG,
408 * UDAT_MEDIUM, UDAT_SHORT, or UDAT_DEFAULT
409 * @param locale The locale specifying the formatting conventions
410 * @param tzID A timezone ID specifying the timezone to use. If 0, use
411 * the default timezone.
412 * @param tzIDLength The length of tzID, or -1 if null-terminated.
413 * @param pattern A pattern specifying the format to use.
414 * @param patternLength The number of characters in the pattern, or -1 if null-terminated.
415 * @param status A pointer to an UErrorCode to receive any errors
416 * @return A pointer to a UDateFormat to use for formatting dates and times, or 0 if
420 U_STABLE UDateFormat
* U_EXPORT2
421 udat_open(UDateFormatStyle timeStyle
,
422 UDateFormatStyle dateStyle
,
426 const UChar
*pattern
,
427 int32_t patternLength
,
432 * Close a UDateFormat.
433 * Once closed, a UDateFormat may no longer be used.
434 * @param format The formatter to close.
437 U_STABLE
void U_EXPORT2
438 udat_close(UDateFormat
* format
);
441 * Open a copy of a UDateFormat.
442 * This function performs a deep copy.
443 * @param fmt The format to copy
444 * @param status A pointer to an UErrorCode to receive any errors.
445 * @return A pointer to a UDateFormat identical to fmt.
448 U_STABLE UDateFormat
* U_EXPORT2
449 udat_clone(const UDateFormat
*fmt
,
453 * Format a date using an UDateFormat.
454 * The date will be formatted using the conventions specified in {@link #udat_open }
455 * @param format The formatter to use
456 * @param dateToFormat The date to format
457 * @param result A pointer to a buffer to receive the formatted number.
458 * @param resultLength The maximum size of result.
459 * @param position A pointer to a UFieldPosition. On input, position->field
460 * is read. On output, position->beginIndex and position->endIndex indicate
461 * the beginning and ending indices of field number position->field, if such
462 * a field exists. This parameter may be NULL, in which case no field
463 * position data is returned.
464 * @param status A pointer to an UErrorCode to receive any errors
465 * @return The total buffer size needed; if greater than resultLength, the output was truncated.
467 * @see UFieldPosition
470 U_STABLE
int32_t U_EXPORT2
471 udat_format( const UDateFormat
* format
,
474 int32_t resultLength
,
475 UFieldPosition
* position
,
479 * Parse a string into an date/time using a UDateFormat.
480 * The date will be parsed using the conventions specified in {@link #udat_open }
481 * @param format The formatter to use.
482 * @param text The text to parse.
483 * @param textLength The length of text, or -1 if null-terminated.
484 * @param parsePos If not 0, on input a pointer to an integer specifying the offset at which
485 * to begin parsing. If not 0, on output the offset at which parsing ended.
486 * @param status A pointer to an UErrorCode to receive any errors
487 * @return The value of the parsed date/time
491 U_STABLE UDate U_EXPORT2
492 udat_parse( const UDateFormat
* format
,
499 * Parse a string into an date/time using a UDateFormat.
500 * The date will be parsed using the conventions specified in {@link #udat_open }
501 * @param format The formatter to use.
502 * @param calendar The calendar in which to store the parsed data.
503 * @param text The text to parse.
504 * @param textLength The length of text, or -1 if null-terminated.
505 * @param parsePos If not 0, on input a pointer to an integer specifying the offset at which
506 * to begin parsing. If not 0, on output the offset at which parsing ended.
507 * @param status A pointer to an UErrorCode to receive any errors
511 U_STABLE
void U_EXPORT2
512 udat_parseCalendar(const UDateFormat
* format
,
520 * Determine if an UDateFormat will perform lenient parsing.
521 * With lenient parsing, the parser may use heuristics to interpret inputs that do not
522 * precisely match the pattern. With strict parsing, inputs must match the pattern.
523 * @param fmt The formatter to query
524 * @return TRUE if fmt is set to perform lenient parsing, FALSE otherwise.
525 * @see udat_setLenient
528 U_STABLE UBool U_EXPORT2
529 udat_isLenient(const UDateFormat
* fmt
);
532 * Specify whether an UDateFormat will perform lenient parsing.
533 * With lenient parsing, the parser may use heuristics to interpret inputs that do not
534 * precisely match the pattern. With strict parsing, inputs must match the pattern.
535 * @param fmt The formatter to set
536 * @param isLenient TRUE if fmt should perform lenient parsing, FALSE otherwise.
540 U_STABLE
void U_EXPORT2
541 udat_setLenient( UDateFormat
* fmt
,
545 * Get the UCalendar associated with an UDateFormat.
546 * A UDateFormat uses a UCalendar to convert a raw value to, for example,
547 * the day of the week.
548 * @param fmt The formatter to query.
549 * @return A pointer to the UCalendar used by fmt.
550 * @see udat_setCalendar
553 U_STABLE
const UCalendar
* U_EXPORT2
554 udat_getCalendar(const UDateFormat
* fmt
);
557 * Set the UCalendar associated with an UDateFormat.
558 * A UDateFormat uses a UCalendar to convert a raw value to, for example,
559 * the day of the week.
560 * @param fmt The formatter to set.
561 * @param calendarToSet A pointer to an UCalendar to be used by fmt.
562 * @see udat_setCalendar
565 U_STABLE
void U_EXPORT2
566 udat_setCalendar( UDateFormat
* fmt
,
567 const UCalendar
* calendarToSet
);
570 * Get the UNumberFormat associated with an UDateFormat.
571 * A UDateFormat uses a UNumberFormat to format numbers within a date,
572 * for example the day number.
573 * @param fmt The formatter to query.
574 * @return A pointer to the UNumberFormat used by fmt to format numbers.
575 * @see udat_setNumberFormat
578 U_STABLE
const UNumberFormat
* U_EXPORT2
579 udat_getNumberFormat(const UDateFormat
* fmt
);
582 * Set the UNumberFormat associated with an UDateFormat.
583 * A UDateFormat uses a UNumberFormat to format numbers within a date,
584 * for example the day number.
585 * @param fmt The formatter to set.
586 * @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to format numbers.
587 * @see udat_getNumberFormat
590 U_STABLE
void U_EXPORT2
591 udat_setNumberFormat( UDateFormat
* fmt
,
592 const UNumberFormat
* numberFormatToSet
);
595 * Get a locale for which date/time formatting patterns are available.
596 * A UDateFormat in a locale returned by this function will perform the correct
597 * formatting and parsing for the locale.
598 * @param index The index of the desired locale.
599 * @return A locale for which date/time formatting patterns are available, or 0 if none.
600 * @see udat_countAvailable
603 U_STABLE
const char* U_EXPORT2
604 udat_getAvailable(int32_t index
);
607 * Determine how many locales have date/time formatting patterns available.
608 * This function is most useful as determining the loop ending condition for
609 * calls to {@link #udat_getAvailable }.
610 * @return The number of locales for which date/time formatting patterns are available.
611 * @see udat_getAvailable
614 U_STABLE
int32_t U_EXPORT2
615 udat_countAvailable(void);
618 * Get the year relative to which all 2-digit years are interpreted.
619 * For example, if the 2-digit start year is 2100, the year 99 will be
620 * interpreted as 2199.
621 * @param fmt The formatter to query.
622 * @param status A pointer to an UErrorCode to receive any errors
623 * @return The year relative to which all 2-digit years are interpreted.
624 * @see udat_Set2DigitYearStart
627 U_STABLE UDate U_EXPORT2
628 udat_get2DigitYearStart( const UDateFormat
*fmt
,
632 * Set the year relative to which all 2-digit years will be interpreted.
633 * For example, if the 2-digit start year is 2100, the year 99 will be
634 * interpreted as 2199.
635 * @param fmt The formatter to set.
636 * @param d The year relative to which all 2-digit years will be interpreted.
637 * @param status A pointer to an UErrorCode to receive any errors
638 * @see udat_Set2DigitYearStart
641 U_STABLE
void U_EXPORT2
642 udat_set2DigitYearStart( UDateFormat
*fmt
,
647 * Extract the pattern from a UDateFormat.
648 * The pattern will follow the pattern syntax rules.
649 * @param fmt The formatter to query.
650 * @param localized TRUE if the pattern should be localized, FALSE otherwise.
651 * @param result A pointer to a buffer to receive the pattern.
652 * @param resultLength The maximum size of result.
653 * @param status A pointer to an UErrorCode to receive any errors
654 * @return The total buffer size needed; if greater than resultLength, the output was truncated.
655 * @see udat_applyPattern
658 U_STABLE
int32_t U_EXPORT2
659 udat_toPattern( const UDateFormat
*fmt
,
662 int32_t resultLength
,
666 * Set the pattern used by an UDateFormat.
667 * The pattern should follow the pattern syntax rules.
668 * @param format The formatter to set.
669 * @param localized TRUE if the pattern is localized, FALSE otherwise.
670 * @param pattern The new pattern
671 * @param patternLength The length of pattern, or -1 if null-terminated.
672 * @see udat_toPattern
675 U_STABLE
void U_EXPORT2
676 udat_applyPattern( UDateFormat
*format
,
678 const UChar
*pattern
,
679 int32_t patternLength
);
682 * The possible types of date format symbols
685 typedef enum UDateFormatSymbolType
{
686 /** The era names, for example AD */
688 /** The month names, for example February */
690 /** The short month names, for example Feb. */
692 /** The weekday names, for example Monday */
694 /** The short weekday names, for example Mon. */
696 /** The AM/PM names, for example AM */
698 /** The localized characters */
699 UDAT_LOCALIZED_CHARS
,
700 /** The long era names, for example Anno Domini */
702 /** The narrow month names, for example F */
704 /** The narrow weekday names, for example N */
705 UDAT_NARROW_WEEKDAYS
,
706 /** Standalone context versions of months */
707 UDAT_STANDALONE_MONTHS
,
708 UDAT_STANDALONE_SHORT_MONTHS
,
709 UDAT_STANDALONE_NARROW_MONTHS
,
710 /** Standalone context versions of weekdays */
711 UDAT_STANDALONE_WEEKDAYS
,
712 UDAT_STANDALONE_SHORT_WEEKDAYS
,
713 UDAT_STANDALONE_NARROW_WEEKDAYS
,
714 /** The quarters, for example 1st Quarter */
716 /** The short quarter names, for example Q1 */
718 /** Standalone context versions of quarters */
719 UDAT_STANDALONE_QUARTERS
,
720 UDAT_STANDALONE_SHORT_QUARTERS
722 } UDateFormatSymbolType
;
724 struct UDateFormatSymbols
;
725 /** Date format symbols.
726 * For usage in C programs.
729 typedef struct UDateFormatSymbols UDateFormatSymbols
;
732 * Get the symbols associated with an UDateFormat.
733 * The symbols are what a UDateFormat uses to represent locale-specific data,
734 * for example month or day names.
735 * @param fmt The formatter to query.
736 * @param type The type of symbols to get. One of UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS,
737 * UDAT_WEEKDAYS, UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, or UDAT_LOCALIZED_CHARS
738 * @param index The desired symbol of type type.
739 * @param result A pointer to a buffer to receive the pattern.
740 * @param resultLength The maximum size of result.
741 * @param status A pointer to an UErrorCode to receive any errors
742 * @return The total buffer size needed; if greater than resultLength, the output was truncated.
743 * @see udat_countSymbols
744 * @see udat_setSymbols
747 U_STABLE
int32_t U_EXPORT2
748 udat_getSymbols(const UDateFormat
*fmt
,
749 UDateFormatSymbolType type
,
752 int32_t resultLength
,
756 * Count the number of particular symbols for an UDateFormat.
757 * This function is most useful as for detemining the loop termination condition
758 * for calls to {@link #udat_getSymbols }.
759 * @param fmt The formatter to query.
760 * @param type The type of symbols to count. One of UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS,
761 * UDAT_WEEKDAYS, UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, or UDAT_LOCALIZED_CHARS
762 * @return The number of symbols of type type.
763 * @see udat_getSymbols
764 * @see udat_setSymbols
767 U_STABLE
int32_t U_EXPORT2
768 udat_countSymbols( const UDateFormat
*fmt
,
769 UDateFormatSymbolType type
);
772 * Set the symbols associated with an UDateFormat.
773 * The symbols are what a UDateFormat uses to represent locale-specific data,
774 * for example month or day names.
775 * @param format The formatter to set
776 * @param type The type of symbols to set. One of UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS,
777 * UDAT_WEEKDAYS, UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, or UDAT_LOCALIZED_CHARS
778 * @param index The index of the symbol to set of type type.
779 * @param value The new value
780 * @param valueLength The length of value, or -1 if null-terminated
781 * @param status A pointer to an UErrorCode to receive any errors
782 * @see udat_getSymbols
783 * @see udat_countSymbols
786 U_STABLE
void U_EXPORT2
787 udat_setSymbols( UDateFormat
*format
,
788 UDateFormatSymbolType type
,
795 * Get the locale for this date format object.
796 * You can choose between valid and actual locale.
797 * @param fmt The formatter to get the locale from
798 * @param type type of the locale we're looking for (valid or actual)
799 * @param status error code for the operation
800 * @return the locale name
803 U_STABLE
const char* U_EXPORT2
804 udat_getLocaleByType(const UDateFormat
*fmt
,
805 ULocDataLocaleType type
,
808 #endif /* #if !UCONFIG_NO_FORMATTING */