2 ********************************************************************************
3 * Copyright (C) 1997-2012, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 ********************************************************************************
9 * Modification History:
11 * Date Name Description
12 * 02/19/97 aliu Converted from java.
13 * 04/01/97 aliu Added support for centuries.
14 * 07/23/98 stephen JDK 1.2 sync
15 * 11/15/99 weiv Added support for week of year/day of week formatting
16 ********************************************************************************
22 #include "unicode/utypes.h"
24 #if !UCONFIG_NO_FORMATTING
26 #include "unicode/udat.h"
27 #include "unicode/calendar.h"
28 #include "unicode/numfmt.h"
29 #include "unicode/format.h"
30 #include "unicode/locid.h"
34 * \brief C++ API: Abstract class for converting dates.
40 class DateTimePatternGenerator
;
43 * DateFormat is an abstract class for a family of classes that convert dates and
44 * times from their internal representations to textual form and back again in a
45 * language-independent manner. Converting from the internal representation (milliseconds
46 * since midnight, January 1, 1970) to text is known as "formatting," and converting
47 * from text to millis is known as "parsing." We currently define only one concrete
48 * subclass of DateFormat: SimpleDateFormat, which can handle pretty much all normal
49 * date formatting and parsing actions.
51 * DateFormat helps you to format and parse dates for any locale. Your code can
52 * be completely independent of the locale conventions for months, days of the
53 * week, or even the calendar format: lunar vs. solar.
55 * To format a date for the current Locale, use one of the static factory
59 * DateFormat* dfmt = DateFormat::createDateInstance();
60 * UDate myDate = Calendar::getNow();
61 * UnicodeString myString;
62 * myString = dfmt->format( myDate, myString );
65 * If you are formatting multiple numbers, it is more efficient to get the
66 * format and use it multiple times so that the system doesn't have to fetch the
67 * information about the local language and country conventions multiple times.
70 * DateFormat* df = DateFormat::createDateInstance();
71 * UnicodeString myString;
72 * UDate myDateArr[] = { 0.0, 100000000.0, 2000000000.0 }; // test values
73 * for (int32_t i = 0; i < 3; ++i) {
75 * cout << df->format( myDateArr[i], myString ) << endl;
79 * To get specific fields of a date, you can use UFieldPosition to
80 * get specific fields.
83 * DateFormat* dfmt = DateFormat::createDateInstance();
84 * FieldPosition pos(DateFormat::YEAR_FIELD);
85 * UnicodeString myString;
86 * myString = dfmt->format( myDate, myString );
87 * cout << myString << endl;
88 * cout << pos.getBeginIndex() << "," << pos. getEndIndex() << endl;
91 * To format a date for a different Locale, specify it in the call to
92 * createDateInstance().
96 * DateFormat::createDateInstance( DateFormat::SHORT, Locale::getFrance());
99 * You can use a DateFormat to parse also.
102 * UErrorCode status = U_ZERO_ERROR;
103 * UDate myDate = df->parse(myString, status);
106 * Use createDateInstance() to produce the normal date format for that country.
107 * There are other static factory methods available. Use createTimeInstance()
108 * to produce the normal time format for that country. Use createDateTimeInstance()
109 * to produce a DateFormat that formats both date and time. You can pass in
110 * different options to these factory methods to control the length of the
111 * result; from SHORT to MEDIUM to LONG to FULL. The exact result depends on the
112 * locale, but generally:
114 * <li> SHORT is completely numeric, such as 12/13/52 or 3:30pm
115 * <li> MEDIUM is longer, such as Jan 12, 1952
116 * <li> LONG is longer, such as January 12, 1952 or 3:30:32pm
117 * <li> FULL is pretty completely specified, such as
118 * Tuesday, April 12, 1952 AD or 3:30:42pm PST.
120 * You can also set the time zone on the format if you wish. If you want even
121 * more control over the format or parsing, (or want to give your users more
122 * control), you can try casting the DateFormat you get from the factory methods
123 * to a SimpleDateFormat. This will work for the majority of countries; just
124 * remember to chck getDynamicClassID() before carrying out the cast.
126 * You can also use forms of the parse and format methods with ParsePosition and
127 * FieldPosition to allow you to
129 * <li> Progressively parse through pieces of a string.
130 * <li> Align any particular field, or find out where it is for selection
134 * <p><em>User subclasses are not supported.</em> While clients may write
135 * subclasses, such code will not necessarily work and will not be
136 * guaranteed to work stably from release to release.
138 class U_I18N_API DateFormat
: public Format
{
142 * Constants for various style patterns. These reflect the order of items in
143 * the DateTimePatterns resource. There are 4 time patterns, 4 date patterns,
144 * the default date-time pattern, and 4 date-time patterns. Each block of 4 values
145 * in the resource occurs in the order full, long, medium, short.
157 kDateOffset
= kShort
+ 1,
158 // kFull + kDateOffset = 4
159 // kLong + kDateOffset = 5
160 // kMedium + kDateOffset = 6
161 // kShort + kDateOffset = 7
166 kDateTimeOffset
= kDateTime
+ 1,
167 // kFull + kDateTimeOffset = 9
168 // kLong + kDateTimeOffset = 10
169 // kMedium + kDateTimeOffset = 11
170 // kShort + kDateTimeOffset = 12
173 kRelative
= (1 << 7),
175 kFullRelative
= (kFull
| kRelative
),
177 kLongRelative
= kLong
| kRelative
,
179 kMediumRelative
= kMedium
| kRelative
,
181 kShortRelative
= kShort
| kRelative
,
189 * These constants are provided for backwards compatibility only.
190 * Please use the C++ style constants defined above.
197 DATE_OFFSET
= kDateOffset
,
199 DATE_TIME
= kDateTime
206 virtual ~DateFormat();
209 * Equality operator. Returns true if the two formats have the same behavior.
212 virtual UBool
operator==(const Format
&) const;
215 using Format::format
;
218 * Format an object to produce a string. This method handles Formattable
219 * objects with a UDate type. If a the Formattable object type is not a Date,
220 * then it returns a failing UErrorCode.
222 * @param obj The object to format. Must be a Date.
223 * @param appendTo Output parameter to receive result.
224 * Result is appended to existing contents.
225 * @param pos On input: an alignment field, if desired.
226 * On output: the offsets of the alignment field.
227 * @param status Output param filled with success/failure status.
228 * @return Reference to 'appendTo' parameter.
231 virtual UnicodeString
& format(const Formattable
& obj
,
232 UnicodeString
& appendTo
,
234 UErrorCode
& status
) const;
237 * Format an object to produce a string. This method handles Formattable
238 * objects with a UDate type. If a the Formattable object type is not a Date,
239 * then it returns a failing UErrorCode.
241 * @param obj The object to format. Must be a Date.
242 * @param appendTo Output parameter to receive result.
243 * Result is appended to existing contents.
244 * @param posIter On return, can be used to iterate over positions
245 * of fields generated by this format call. Field values
246 * are defined in UDateFormatField. Can be NULL.
247 * @param status Output param filled with success/failure status.
248 * @return Reference to 'appendTo' parameter.
251 virtual UnicodeString
& format(const Formattable
& obj
,
252 UnicodeString
& appendTo
,
253 FieldPositionIterator
* posIter
,
254 UErrorCode
& status
) const;
256 * Formats a date into a date/time string. This is an abstract method which
257 * concrete subclasses must implement.
259 * On input, the FieldPosition parameter may have its "field" member filled with
260 * an enum value specifying a field. On output, the FieldPosition will be filled
261 * in with the text offsets for that field.
262 * <P> For example, given a time text
263 * "1996.07.10 AD at 15:08:56 PDT", if the given fieldPosition.field is
264 * UDAT_YEAR_FIELD, the offsets fieldPosition.beginIndex and
265 * statfieldPositionus.getEndIndex will be set to 0 and 4, respectively.
267 * that if the same time field appears more than once in a pattern, the status will
268 * be set for the first occurence of that time field. For instance,
269 * formatting a UDate to the time string "1 PM PDT (Pacific Daylight Time)"
270 * using the pattern "h a z (zzzz)" and the alignment field
271 * DateFormat::TIMEZONE_FIELD, the offsets fieldPosition.beginIndex and
272 * fieldPosition.getEndIndex will be set to 5 and 8, respectively, for the first
273 * occurence of the timezone pattern character 'z'.
275 * @param cal Calendar set to the date and time to be formatted
276 * into a date/time string. When the calendar type is
277 * different from the internal calendar held by this
278 * DateFormat instance, the date and the time zone will
279 * be inherited from the input calendar, but other calendar
280 * field values will be calculated by the internal calendar.
281 * @param appendTo Output parameter to receive result.
282 * Result is appended to existing contents.
283 * @param fieldPosition On input: an alignment field, if desired (see examples above)
284 * On output: the offsets of the alignment field (see examples above)
285 * @return Reference to 'appendTo' parameter.
288 virtual UnicodeString
& format( Calendar
& cal
,
289 UnicodeString
& appendTo
,
290 FieldPosition
& fieldPosition
) const = 0;
293 * Formats a date into a date/time string. Subclasses should implement this method.
295 * @param cal Calendar set to the date and time to be formatted
296 * into a date/time string. When the calendar type is
297 * different from the internal calendar held by this
298 * DateFormat instance, the date and the time zone will
299 * be inherited from the input calendar, but other calendar
300 * field values will be calculated by the internal calendar.
301 * @param appendTo Output parameter to receive result.
302 * Result is appended to existing contents.
303 * @param posIter On return, can be used to iterate over positions
304 * of fields generated by this format call. Field values
305 * are defined in UDateFormatField. Can be NULL.
306 * @param status error status.
307 * @return Reference to 'appendTo' parameter.
310 virtual UnicodeString
& format(Calendar
& cal
,
311 UnicodeString
& appendTo
,
312 FieldPositionIterator
* posIter
,
313 UErrorCode
& status
) const;
315 * Formats a UDate into a date/time string.
317 * On input, the FieldPosition parameter may have its "field" member filled with
318 * an enum value specifying a field. On output, the FieldPosition will be filled
319 * in with the text offsets for that field.
320 * <P> For example, given a time text
321 * "1996.07.10 AD at 15:08:56 PDT", if the given fieldPosition.field is
322 * UDAT_YEAR_FIELD, the offsets fieldPosition.beginIndex and
323 * statfieldPositionus.getEndIndex will be set to 0 and 4, respectively.
325 * that if the same time field appears more than once in a pattern, the status will
326 * be set for the first occurence of that time field. For instance,
327 * formatting a UDate to the time string "1 PM PDT (Pacific Daylight Time)"
328 * using the pattern "h a z (zzzz)" and the alignment field
329 * DateFormat::TIMEZONE_FIELD, the offsets fieldPosition.beginIndex and
330 * fieldPosition.getEndIndex will be set to 5 and 8, respectively, for the first
331 * occurence of the timezone pattern character 'z'.
333 * @param date UDate to be formatted into a date/time string.
334 * @param appendTo Output parameter to receive result.
335 * Result is appended to existing contents.
336 * @param fieldPosition On input: an alignment field, if desired (see examples above)
337 * On output: the offsets of the alignment field (see examples above)
338 * @return Reference to 'appendTo' parameter.
341 UnicodeString
& format( UDate date
,
342 UnicodeString
& appendTo
,
343 FieldPosition
& fieldPosition
) const;
346 * Formats a UDate into a date/time string.
348 * @param date UDate to be formatted into a date/time string.
349 * @param appendTo Output parameter to receive result.
350 * Result is appended to existing contents.
351 * @param posIter On return, can be used to iterate over positions
352 * of fields generated by this format call. Field values
353 * are defined in UDateFormatField. Can be NULL.
354 * @param status error status.
355 * @return Reference to 'appendTo' parameter.
358 UnicodeString
& format(UDate date
,
359 UnicodeString
& appendTo
,
360 FieldPositionIterator
* posIter
,
361 UErrorCode
& status
) const;
363 * Formats a UDate into a date/time string. If there is a problem, you won't
364 * know, using this method. Use the overloaded format() method which takes a
365 * FieldPosition& to detect formatting problems.
367 * @param date The UDate value to be formatted into a string.
368 * @param appendTo Output parameter to receive result.
369 * Result is appended to existing contents.
370 * @return Reference to 'appendTo' parameter.
373 UnicodeString
& format(UDate date
, UnicodeString
& appendTo
) const;
376 * Redeclared Format method.
378 * @param obj The object to be formatted into a string.
379 * @param appendTo Output parameter to receive result.
380 * Result is appended to existing contents.
381 * @param status Output param filled with success/failure status.
382 * @return Reference to 'appendTo' parameter.
385 UnicodeString
& format(const Formattable
& obj
,
386 UnicodeString
& appendTo
,
387 UErrorCode
& status
) const;
390 * Parse a date/time string. For example, a time text "07/10/96 4:5 PM, PDT"
391 * will be parsed into a UDate that is equivalent to Date(837039928046).
392 * Parsing begins at the beginning of the string and proceeds as far as
393 * possible. Assuming no parse errors were encountered, this function
394 * doesn't return any information about how much of the string was consumed
395 * by the parsing. If you need that information, use the version of
396 * parse() that takes a ParsePosition.
398 * By default, parsing is lenient: If the input is not in the form used by
399 * this object's format method but can still be parsed as a date, then the
400 * parse succeeds. Clients may insist on strict adherence to the format by
401 * calling setLenient(false).
402 * @see DateFormat::setLenient(boolean)
404 * Note that the normal date formats associated with some calendars - such
405 * as the Chinese lunar calendar - do not specify enough fields to enable
406 * dates to be parsed unambiguously. In the case of the Chinese lunar
407 * calendar, while the year within the current 60-year cycle is specified,
408 * the number of such cycles since the start date of the calendar (in the
409 * ERA field of the Calendar object) is not normally part of the format,
410 * and parsing may assume the wrong era. For cases such as this it is
411 * recommended that clients parse using the method
412 * parse(const UnicodeString&, Calendar& cal, ParsePosition&)
413 * with the Calendar passed in set to the current date, or to a date
414 * within the era/cycle that should be assumed if absent in the format.
416 * @param text The date/time string to be parsed into a UDate value.
417 * @param status Output param to be set to success/failure code. If
418 * 'text' cannot be parsed, it will be set to a failure
420 * @return The parsed UDate value, if successful.
423 virtual UDate
parse( const UnicodeString
& text
,
424 UErrorCode
& status
) const;
427 * Parse a date/time string beginning at the given parse position. For
428 * example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date
429 * that is equivalent to Date(837039928046).
431 * By default, parsing is lenient: If the input is not in the form used by
432 * this object's format method but can still be parsed as a date, then the
433 * parse succeeds. Clients may insist on strict adherence to the format by
434 * calling setLenient(false).
435 * @see DateFormat::setLenient(boolean)
437 * @param text The date/time string to be parsed.
438 * @param cal A Calendar set on input to the date and time to be used for
439 * missing values in the date/time string being parsed, and set
440 * on output to the parsed date/time. When the calendar type is
441 * different from the internal calendar held by this DateFormat
442 * instance, the internal calendar will be cloned to a work
443 * calendar set to the same milliseconds and time zone as the
444 * cal parameter, field values will be parsed based on the work
445 * calendar, then the result (milliseconds and time zone) will
446 * be set in this calendar.
447 * @param pos On input, the position at which to start parsing; on
448 * output, the position at which parsing terminated, or the
449 * start position if the parse failed.
452 virtual void parse( const UnicodeString
& text
,
454 ParsePosition
& pos
) const = 0;
457 * Parse a date/time string beginning at the given parse position. For
458 * example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date
459 * that is equivalent to Date(837039928046).
461 * By default, parsing is lenient: If the input is not in the form used by
462 * this object's format method but can still be parsed as a date, then the
463 * parse succeeds. Clients may insist on strict adherence to the format by
464 * calling setLenient(false).
465 * @see DateFormat::setLenient(boolean)
467 * Note that the normal date formats associated with some calendars - such
468 * as the Chinese lunar calendar - do not specify enough fields to enable
469 * dates to be parsed unambiguously. In the case of the Chinese lunar
470 * calendar, while the year within the current 60-year cycle is specified,
471 * the number of such cycles since the start date of the calendar (in the
472 * ERA field of the Calendar object) is not normally part of the format,
473 * and parsing may assume the wrong era. For cases such as this it is
474 * recommended that clients parse using the method
475 * parse(const UnicodeString&, Calendar& cal, ParsePosition&)
476 * with the Calendar passed in set to the current date, or to a date
477 * within the era/cycle that should be assumed if absent in the format.
479 * @param text The date/time string to be parsed into a UDate value.
480 * @param pos On input, the position at which to start parsing; on
481 * output, the position at which parsing terminated, or the
482 * start position if the parse failed.
483 * @return A valid UDate if the input could be parsed.
486 UDate
parse( const UnicodeString
& text
,
487 ParsePosition
& pos
) const;
490 * Parse a string to produce an object. This methods handles parsing of
491 * date/time strings into Formattable objects with UDate types.
493 * Before calling, set parse_pos.index to the offset you want to start
494 * parsing at in the source. After calling, parse_pos.index is the end of
495 * the text you parsed. If error occurs, index is unchanged.
497 * When parsing, leading whitespace is discarded (with a successful parse),
498 * while trailing whitespace is left as is.
500 * See Format::parseObject() for more.
502 * @param source The string to be parsed into an object.
503 * @param result Formattable to be set to the parse result.
504 * If parse fails, return contents are undefined.
505 * @param parse_pos The position to start parsing at. Upon return
506 * this param is set to the position after the
507 * last character successfully parsed. If the
508 * source is not parsed successfully, this param
509 * will remain unchanged.
510 * @return A newly created Formattable* object, or NULL
511 * on failure. The caller owns this and should
512 * delete it when done.
515 virtual void parseObject(const UnicodeString
& source
,
517 ParsePosition
& parse_pos
) const;
520 * Create a default date/time formatter that uses the SHORT style for both
521 * the date and the time.
523 * @return A date/time formatter which the caller owns.
526 static DateFormat
* U_EXPORT2
createInstance(void);
529 * Creates a time formatter with the given formatting style for the given
532 * @param style The given formatting style. For example,
533 * SHORT for "h:mm a" in the US locale. Relative
534 * time styles are not currently supported.
535 * @param aLocale The given locale.
536 * @return A time formatter which the caller owns.
539 static DateFormat
* U_EXPORT2
createTimeInstance(EStyle style
= kDefault
,
540 const Locale
& aLocale
= Locale::getDefault());
543 * Creates a date formatter with the given formatting style for the given
546 * @param style The given formatting style. For example, SHORT for "M/d/yy" in the
547 * US locale. As currently implemented, relative date formatting only
548 * affects a limited range of calendar days before or after the
549 * current date, based on the CLDR <field type="day">/<relative> data:
550 * For example, in English, "Yesterday", "Today", and "Tomorrow".
551 * Outside of this range, dates are formatted using the corresponding
552 * non-relative style.
553 * @param aLocale The given locale.
554 * @return A date formatter which the caller owns.
557 static DateFormat
* U_EXPORT2
createDateInstance(EStyle style
= kDefault
,
558 const Locale
& aLocale
= Locale::getDefault());
561 * Creates a date/time formatter with the given formatting styles for the
564 * @param dateStyle The given formatting style for the date portion of the result.
565 * For example, SHORT for "M/d/yy" in the US locale. As currently
566 * implemented, relative date formatting only affects a limited range
567 * of calendar days before or after the current date, based on the
568 * CLDR <field type="day">/<relative> data: For example, in English,
569 * "Yesterday", "Today", and "Tomorrow". Outside of this range, dates
570 * are formatted using the corresponding non-relative style.
571 * @param timeStyle The given formatting style for the time portion of the result.
572 * For example, SHORT for "h:mm a" in the US locale. Relative
573 * time styles are not currently supported.
574 * @param aLocale The given locale.
575 * @return A date/time formatter which the caller owns.
578 static DateFormat
* U_EXPORT2
createDateTimeInstance(EStyle dateStyle
= kDefault
,
579 EStyle timeStyle
= kDefault
,
580 const Locale
& aLocale
= Locale::getDefault());
583 * Gets the set of locales for which DateFormats are installed.
584 * @param count Filled in with the number of locales in the list that is returned.
585 * @return the set of locales for which DateFormats are installed. The caller
586 * does NOT own this list and must not delete it.
589 static const Locale
* U_EXPORT2
getAvailableLocales(int32_t& count
);
592 * Returns true if the formatter is set for lenient parsing.
595 virtual UBool
isLenient(void) const;
598 * Specify whether or not date/time parsing is to be lenient. With lenient
599 * parsing, the parser may use heuristics to interpret inputs that do not
600 * precisely match this object's format. With strict parsing, inputs must
601 * match this object's format.
603 * @param lenient True specifies date/time interpretation to be lenient.
604 * @see Calendar::setLenient
607 virtual void setLenient(UBool lenient
);
610 * Gets the calendar associated with this date/time formatter.
611 * @return the calendar associated with this date/time formatter.
614 virtual const Calendar
* getCalendar(void) const;
617 * Set the calendar to be used by this date format. Initially, the default
618 * calendar for the specified or default locale is used. The caller should
619 * not delete the Calendar object after it is adopted by this call.
620 * Adopting a new calendar will change to the default symbols.
622 * @param calendarToAdopt Calendar object to be adopted.
625 virtual void adoptCalendar(Calendar
* calendarToAdopt
);
628 * Set the calendar to be used by this date format. Initially, the default
629 * calendar for the specified or default locale is used.
631 * @param newCalendar Calendar object to be set.
634 virtual void setCalendar(const Calendar
& newCalendar
);
638 * Gets the number formatter which this date/time formatter uses to format
639 * and parse the numeric portions of the pattern.
640 * @return the number formatter which this date/time formatter uses.
643 virtual const NumberFormat
* getNumberFormat(void) const;
646 * Allows you to set the number formatter. The caller should
647 * not delete the NumberFormat object after it is adopted by this call.
648 * @param formatToAdopt NumberFormat object to be adopted.
651 virtual void adoptNumberFormat(NumberFormat
* formatToAdopt
);
654 * Allows you to set the number formatter.
655 * @param newNumberFormat NumberFormat object to be set.
658 virtual void setNumberFormat(const NumberFormat
& newNumberFormat
);
661 * Returns a reference to the TimeZone used by this DateFormat's calendar.
662 * @return the time zone associated with the calendar of DateFormat.
665 virtual const TimeZone
& getTimeZone(void) const;
668 * Sets the time zone for the calendar of this DateFormat object. The caller
669 * no longer owns the TimeZone object and should not delete it after this call.
670 * @param zoneToAdopt the TimeZone to be adopted.
673 virtual void adoptTimeZone(TimeZone
* zoneToAdopt
);
676 * Sets the time zone for the calendar of this DateFormat object.
677 * @param zone the new time zone.
680 virtual void setTimeZone(const TimeZone
& zone
);
684 * Default constructor. Creates a DateFormat with no Calendar or NumberFormat
685 * associated with it. This constructor depends on the subclasses to fill in
686 * the calendar and numberFormat fields.
695 DateFormat(const DateFormat
&);
698 * Default assignment operator.
701 DateFormat
& operator=(const DateFormat
&);
704 * The calendar that DateFormat uses to produce the time field values needed
705 * to implement date/time formatting. Subclasses should generally initialize
706 * this to the default calendar for the locale associated with this DateFormat.
712 * The number formatter that DateFormat uses to format numbers in dates and
713 * times. Subclasses should generally initialize this to the default number
714 * format for the locale associated with this DateFormat.
717 NumberFormat
* fNumberFormat
;
721 * Gets the date/time formatter with the given formatting styles for the
723 * @param dateStyle the given date formatting style.
724 * @param timeStyle the given time formatting style.
725 * @param inLocale the given locale.
726 * @return a date/time formatter, or 0 on failure.
728 static DateFormat
* U_EXPORT2
create(EStyle timeStyle
, EStyle dateStyle
, const Locale
& inLocale
);
731 #ifndef U_HIDE_OBSOLETE_API
733 * Field selector for FieldPosition for DateFormat fields.
734 * @obsolete ICU 3.4 use UDateFormatField instead, since this API will be
735 * removed in that release
739 // Obsolete; use UDateFormatField instead
740 kEraField
= UDAT_ERA_FIELD
,
741 kYearField
= UDAT_YEAR_FIELD
,
742 kMonthField
= UDAT_MONTH_FIELD
,
743 kDateField
= UDAT_DATE_FIELD
,
744 kHourOfDay1Field
= UDAT_HOUR_OF_DAY1_FIELD
,
745 kHourOfDay0Field
= UDAT_HOUR_OF_DAY0_FIELD
,
746 kMinuteField
= UDAT_MINUTE_FIELD
,
747 kSecondField
= UDAT_SECOND_FIELD
,
748 kMillisecondField
= UDAT_FRACTIONAL_SECOND_FIELD
,
749 kDayOfWeekField
= UDAT_DAY_OF_WEEK_FIELD
,
750 kDayOfYearField
= UDAT_DAY_OF_YEAR_FIELD
,
751 kDayOfWeekInMonthField
= UDAT_DAY_OF_WEEK_IN_MONTH_FIELD
,
752 kWeekOfYearField
= UDAT_WEEK_OF_YEAR_FIELD
,
753 kWeekOfMonthField
= UDAT_WEEK_OF_MONTH_FIELD
,
754 kAmPmField
= UDAT_AM_PM_FIELD
,
755 kHour1Field
= UDAT_HOUR1_FIELD
,
756 kHour0Field
= UDAT_HOUR0_FIELD
,
757 kTimezoneField
= UDAT_TIMEZONE_FIELD
,
758 kYearWOYField
= UDAT_YEAR_WOY_FIELD
,
759 kDOWLocalField
= UDAT_DOW_LOCAL_FIELD
,
760 kExtendedYearField
= UDAT_EXTENDED_YEAR_FIELD
,
761 kJulianDayField
= UDAT_JULIAN_DAY_FIELD
,
762 kMillisecondsInDayField
= UDAT_MILLISECONDS_IN_DAY_FIELD
,
764 // Obsolete; use UDateFormatField instead
765 ERA_FIELD
= UDAT_ERA_FIELD
,
766 YEAR_FIELD
= UDAT_YEAR_FIELD
,
767 MONTH_FIELD
= UDAT_MONTH_FIELD
,
768 DATE_FIELD
= UDAT_DATE_FIELD
,
769 HOUR_OF_DAY1_FIELD
= UDAT_HOUR_OF_DAY1_FIELD
,
770 HOUR_OF_DAY0_FIELD
= UDAT_HOUR_OF_DAY0_FIELD
,
771 MINUTE_FIELD
= UDAT_MINUTE_FIELD
,
772 SECOND_FIELD
= UDAT_SECOND_FIELD
,
773 MILLISECOND_FIELD
= UDAT_FRACTIONAL_SECOND_FIELD
,
774 DAY_OF_WEEK_FIELD
= UDAT_DAY_OF_WEEK_FIELD
,
775 DAY_OF_YEAR_FIELD
= UDAT_DAY_OF_YEAR_FIELD
,
776 DAY_OF_WEEK_IN_MONTH_FIELD
= UDAT_DAY_OF_WEEK_IN_MONTH_FIELD
,
777 WEEK_OF_YEAR_FIELD
= UDAT_WEEK_OF_YEAR_FIELD
,
778 WEEK_OF_MONTH_FIELD
= UDAT_WEEK_OF_MONTH_FIELD
,
779 AM_PM_FIELD
= UDAT_AM_PM_FIELD
,
780 HOUR1_FIELD
= UDAT_HOUR1_FIELD
,
781 HOUR0_FIELD
= UDAT_HOUR0_FIELD
,
782 TIMEZONE_FIELD
= UDAT_TIMEZONE_FIELD
784 #endif /* U_HIDE_OBSOLETE_API */
787 inline UnicodeString
&
788 DateFormat::format(const Formattable
& obj
,
789 UnicodeString
& appendTo
,
790 UErrorCode
& status
) const {
791 return Format::format(obj
, appendTo
, status
);
795 #endif /* #if !UCONFIG_NO_FORMATTING */