• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  ********************************************************************************
3  *   Copyright (C) 1997-2007, International Business Machines
4  *   Corporation and others.  All Rights Reserved.
5  ********************************************************************************
6  *
7  * File DATEFMT.H
8  *
9  * Modification History:
10  *
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  ********************************************************************************
17  */
18 
19 #ifndef DATEFMT_H
20 #define DATEFMT_H
21 
22 #include "unicode/utypes.h"
23 
24 #if !UCONFIG_NO_FORMATTING
25 
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"
31 
32 /**
33  * \file
34  * \brief C++ API: Abstract class for converting dates.
35  */
36 
37 U_NAMESPACE_BEGIN
38 
39 class TimeZone;
40 
41 /**
42  * DateFormat is an abstract class for a family of classes that convert dates and
43  * times from their internal representations to textual form and back again in a
44  * language-independent manner. Converting from the internal representation (milliseconds
45  * since midnight, January 1, 1970) to text is known as "formatting," and converting
46  * from text to millis is known as "parsing."  We currently define only one concrete
47  * subclass of DateFormat: SimpleDateFormat, which can handle pretty much all normal
48  * date formatting and parsing actions.
49  * <P>
50  * DateFormat helps you to format and parse dates for any locale. Your code can
51  * be completely independent of the locale conventions for months, days of the
52  * week, or even the calendar format: lunar vs. solar.
53  * <P>
54  * To format a date for the current Locale, use one of the static factory
55  * methods:
56  * <pre>
57  * \code
58  *      DateFormat* dfmt = DateFormat::createDateInstance();
59  *      UDate myDate = Calendar::getNow();
60  *      UnicodeString myString;
61  *      myString = dfmt->format( myDate, myString );
62  * \endcode
63  * </pre>
64  * If you are formatting multiple numbers, it is more efficient to get the
65  * format and use it multiple times so that the system doesn't have to fetch the
66  * information about the local language and country conventions multiple times.
67  * <pre>
68  * \code
69  *      DateFormat* df = DateFormat::createDateInstance();
70  *      UnicodeString myString;
71  *      UDate myDateArr[] = { 0.0, 100000000.0, 2000000000.0 }; // test values
72  *      for (int32_t i = 0; i < 3; ++i) {
73  *          myString.remove();
74  *          cout << df->format( myDateArr[i], myString ) << endl;
75  *      }
76  * \endcode
77  * </pre>
78  * To get specific fields of a date, you can use UFieldPosition to
79  * get specific fields.
80  * <pre>
81  * \code
82  *      DateFormat* dfmt = DateFormat::createDateInstance();
83  *      FieldPosition pos(DateFormat::YEAR_FIELD);
84  *      UnicodeString myString;
85  *      myString = dfmt->format( myDate, myString );
86  *      cout << myString << endl;
87  *      cout << pos.getBeginIndex() << "," << pos. getEndIndex() << endl;
88  * \endcode
89  * </pre>
90  * To format a date for a different Locale, specify it in the call to
91  * createDateInstance().
92  * <pre>
93  * \code
94  *       DateFormat* df =
95  *           DateFormat::createDateInstance( DateFormat::SHORT, Locale::getFrance());
96  * \endcode
97  * </pre>
98  * You can use a DateFormat to parse also.
99  * <pre>
100  * \code
101  *       UErrorCode status = U_ZERO_ERROR;
102  *       UDate myDate = df->parse(myString, status);
103  * \endcode
104  * </pre>
105  * Use createDateInstance() to produce the normal date format for that country.
106  * There are other static factory methods available. Use createTimeInstance()
107  * to produce the normal time format for that country. Use createDateTimeInstance()
108  * to produce a DateFormat that formats both date and time. You can pass in
109  * different options to these factory methods to control the length of the
110  * result; from SHORT to MEDIUM to LONG to FULL. The exact result depends on the
111  * locale, but generally:
112  * <ul type=round>
113  *   <li>   SHORT is completely numeric, such as 12/13/52 or 3:30pm
114  *   <li>   MEDIUM is longer, such as Jan 12, 1952
115  *   <li>   LONG is longer, such as January 12, 1952 or 3:30:32pm
116  *   <li>   FULL is pretty completely specified, such as
117  *          Tuesday, April 12, 1952 AD or 3:30:42pm PST.
118  * </ul>
119  * You can also set the time zone on the format if you wish. If you want even
120  * more control over the format or parsing, (or want to give your users more
121  * control), you can try casting the DateFormat you get from the factory methods
122  * to a SimpleDateFormat. This will work for the majority of countries; just
123  * remember to chck getDynamicClassID() before carrying out the cast.
124  * <P>
125  * You can also use forms of the parse and format methods with ParsePosition and
126  * FieldPosition to allow you to
127  * <ul type=round>
128  *   <li>   Progressively parse through pieces of a string.
129  *   <li>   Align any particular field, or find out where it is for selection
130  *          on the screen.
131  * </ul>
132  *
133  * <p><em>User subclasses are not supported.</em> While clients may write
134  * subclasses, such code will not necessarily work and will not be
135  * guaranteed to work stably from release to release.
136  */
137 class U_I18N_API DateFormat : public Format {
138 public:
139 
140     /**
141      * Constants for various style patterns. These reflect the order of items in
142      * the DateTimePatterns resource. There are 4 time patterns, 4 date patterns,
143      * and then the date-time pattern. Each block of 4 values in the resource occurs
144      * in the order full, long, medium, short.
145      * @stable ICU 2.4
146      */
147     enum EStyle
148     {
149         kNone   = -1,
150 
151         kFull   = 0,
152         kLong   = 1,
153         kMedium = 2,
154         kShort  = 3,
155 
156         kDateOffset   = kShort + 1,
157      // kFull   + kDateOffset = 4
158      // kLong   + kDateOffset = 5
159      // kMedium + kDateOffset = 6
160      // kShort  + kDateOffset = 7
161 
162         kDateTime             = 8,
163 
164 
165         // relative dates
166         kRelative = (1 << 7),
167 
168         kFullRelative = (kFull | kRelative),
169 
170         kLongRelative = kLong | kRelative,
171 
172         kMediumRelative = kMedium | kRelative,
173 
174         kShortRelative = kShort | kRelative,
175 
176 
177         kDefault      = kMedium,
178 
179 
180 
181     /**
182      * These constants are provided for backwards compatibility only.
183      * Please use the C++ style constants defined above.
184      */
185         FULL        = kFull,
186         LONG        = kLong,
187         MEDIUM        = kMedium,
188         SHORT        = kShort,
189         DEFAULT        = kDefault,
190         DATE_OFFSET    = kDateOffset,
191         NONE        = kNone,
192         DATE_TIME    = kDateTime
193     };
194 
195     /**
196      * Destructor.
197      * @stable ICU 2.0
198      */
199     virtual ~DateFormat();
200 
201     /**
202      * Equality operator.  Returns true if the two formats have the same behavior.
203      * @stable ICU 2.0
204      */
205     virtual UBool operator==(const Format&) const;
206 
207     /**
208      * Format an object to produce a string. This method handles Formattable
209      * objects with a UDate type. If a the Formattable object type is not a Date,
210      * then it returns a failing UErrorCode.
211      *
212      * @param obj       The object to format. Must be a Date.
213      * @param appendTo  Output parameter to receive result.
214      *                  Result is appended to existing contents.
215      * @param pos       On input: an alignment field, if desired.
216      *                  On output: the offsets of the alignment field.
217      * @param status    Output param filled with success/failure status.
218      * @return          Reference to 'appendTo' parameter.
219      * @stable ICU 2.0
220      */
221     virtual UnicodeString& format(const Formattable& obj,
222                                   UnicodeString& appendTo,
223                                   FieldPosition& pos,
224                                   UErrorCode& status) const;
225 
226     /**
227      * Formats a date into a date/time string. This is an abstract method which
228      * concrete subclasses must implement.
229      * <P>
230      * On input, the FieldPosition parameter may have its "field" member filled with
231      * an enum value specifying a field.  On output, the FieldPosition will be filled
232      * in with the text offsets for that field.
233      * <P> For example, given a time text
234      * "1996.07.10 AD at 15:08:56 PDT", if the given fieldPosition.field is
235      * UDAT_YEAR_FIELD, the offsets fieldPosition.beginIndex and
236      * statfieldPositionus.getEndIndex will be set to 0 and 4, respectively.
237      * <P> Notice
238      * that if the same time field appears more than once in a pattern, the status will
239      * be set for the first occurence of that time field. For instance,
240      * formatting a UDate to the time string "1 PM PDT (Pacific Daylight Time)"
241      * using the pattern "h a z (zzzz)" and the alignment field
242      * DateFormat::TIMEZONE_FIELD, the offsets fieldPosition.beginIndex and
243      * fieldPosition.getEndIndex will be set to 5 and 8, respectively, for the first
244      * occurence of the timezone pattern character 'z'.
245      *
246      * @param cal           Calendar set to the date and time to be formatted
247      *                      into a date/time string.
248      * @param appendTo      Output parameter to receive result.
249      *                      Result is appended to existing contents.
250      * @param fieldPosition On input: an alignment field, if desired (see examples above)
251      *                      On output: the offsets of the alignment field (see examples above)
252      * @return              Reference to 'appendTo' parameter.
253      * @stable ICU 2.1
254      */
255     virtual UnicodeString& format(  Calendar& cal,
256                                     UnicodeString& appendTo,
257                                     FieldPosition& fieldPosition) const = 0;
258 
259     /**
260      * Formats a UDate into a date/time string.
261      * <P>
262      * On input, the FieldPosition parameter may have its "field" member filled with
263      * an enum value specifying a field.  On output, the FieldPosition will be filled
264      * in with the text offsets for that field.
265      * <P> For example, given a time text
266      * "1996.07.10 AD at 15:08:56 PDT", if the given fieldPosition.field is
267      * UDAT_YEAR_FIELD, the offsets fieldPosition.beginIndex and
268      * statfieldPositionus.getEndIndex will be set to 0 and 4, respectively.
269      * <P> Notice
270      * that if the same time field appears more than once in a pattern, the status will
271      * be set for the first occurence of that time field. For instance,
272      * formatting a UDate to the time string "1 PM PDT (Pacific Daylight Time)"
273      * using the pattern "h a z (zzzz)" and the alignment field
274      * DateFormat::TIMEZONE_FIELD, the offsets fieldPosition.beginIndex and
275      * fieldPosition.getEndIndex will be set to 5 and 8, respectively, for the first
276      * occurence of the timezone pattern character 'z'.
277      *
278      * @param date          UDate to be formatted into a date/time string.
279      * @param appendTo      Output parameter to receive result.
280      *                      Result is appended to existing contents.
281      * @param fieldPosition On input: an alignment field, if desired (see examples above)
282      *                      On output: the offsets of the alignment field (see examples above)
283      * @return              Reference to 'appendTo' parameter.
284      * @stable ICU 2.0
285      */
286     UnicodeString& format(  UDate date,
287                             UnicodeString& appendTo,
288                             FieldPosition& fieldPosition) const;
289 
290     /**
291      * Formats a UDate into a date/time string. If there is a problem, you won't
292      * know, using this method. Use the overloaded format() method which takes a
293      * FieldPosition& to detect formatting problems.
294      *
295      * @param date      The UDate value to be formatted into a string.
296      * @param appendTo  Output parameter to receive result.
297      *                  Result is appended to existing contents.
298      * @return          Reference to 'appendTo' parameter.
299      * @stable ICU 2.0
300      */
301     UnicodeString& format(UDate date, UnicodeString& appendTo) const;
302 
303     /**
304      * Redeclared Format method.
305      *
306      * @param obj       The object to be formatted into a string.
307      * @param appendTo  Output parameter to receive result.
308      *                  Result is appended to existing contents.
309      * @param status    Output param filled with success/failure status.
310      * @return          Reference to 'appendTo' parameter.
311      * @stable ICU 2.0
312      */
313     UnicodeString& format(const Formattable& obj,
314                           UnicodeString& appendTo,
315                           UErrorCode& status) const;
316 
317     /**
318      * Parse a date/time string.
319      *
320      * @param text      The string to be parsed into a UDate value.
321      * @param status    Output param to be set to success/failure code. If
322      *                  'text' cannot be parsed, it will be set to a failure
323      *                  code.
324      * @result          The parsed UDate value, if successful.
325      * @stable ICU 2.0
326      */
327     virtual UDate parse( const UnicodeString& text,
328                         UErrorCode& status) const;
329 
330     /**
331      * Parse a date/time string beginning at the given parse position. For
332      * example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date
333      * that is equivalent to Date(837039928046).
334      * <P>
335      * By default, parsing is lenient: If the input is not in the form used by
336      * this object's format method but can still be parsed as a date, then the
337      * parse succeeds. Clients may insist on strict adherence to the format by
338      * calling setLenient(false).
339      *
340      * @see DateFormat::setLenient(boolean)
341      *
342      * @param text  The date/time string to be parsed
343      * @param cal   a Calendar set to the date and time to be formatted
344      *              into a date/time string.
345      * @param pos   On input, the position at which to start parsing; on
346      *              output, the position at which parsing terminated, or the
347      *              start position if the parse failed.
348      * @return      A valid UDate if the input could be parsed.
349      * @stable ICU 2.1
350      */
351     virtual void parse( const UnicodeString& text,
352                         Calendar& cal,
353                         ParsePosition& pos) const = 0;
354 
355     /**
356      * Parse a date/time string beginning at the given parse position. For
357      * example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date
358      * that is equivalent to Date(837039928046).
359      * <P>
360      * By default, parsing is lenient: If the input is not in the form used by
361      * this object's format method but can still be parsed as a date, then the
362      * parse succeeds. Clients may insist on strict adherence to the format by
363      * calling setLenient(false).
364      *
365      * @see DateFormat::setLenient(boolean)
366      *
367      * @param text  The date/time string to be parsed
368      * @param pos   On input, the position at which to start parsing; on
369      *              output, the position at which parsing terminated, or the
370      *              start position if the parse failed.
371      * @return      A valid UDate if the input could be parsed.
372      * @stable ICU 2.0
373      */
374     UDate parse( const UnicodeString& text,
375                  ParsePosition& pos) const;
376 
377     /**
378      * Parse a string to produce an object. This methods handles parsing of
379      * date/time strings into Formattable objects with UDate types.
380      * <P>
381      * Before calling, set parse_pos.index to the offset you want to start
382      * parsing at in the source. After calling, parse_pos.index is the end of
383      * the text you parsed. If error occurs, index is unchanged.
384      * <P>
385      * When parsing, leading whitespace is discarded (with a successful parse),
386      * while trailing whitespace is left as is.
387      * <P>
388      * See Format::parseObject() for more.
389      *
390      * @param source    The string to be parsed into an object.
391      * @param result    Formattable to be set to the parse result.
392      *                  If parse fails, return contents are undefined.
393      * @param parse_pos The position to start parsing at. Upon return
394      *                  this param is set to the position after the
395      *                  last character successfully parsed. If the
396      *                  source is not parsed successfully, this param
397      *                  will remain unchanged.
398      * @return          A newly created Formattable* object, or NULL
399      *                  on failure.  The caller owns this and should
400      *                  delete it when done.
401      * @stable ICU 2.0
402      */
403     virtual void parseObject(const UnicodeString& source,
404                              Formattable& result,
405                              ParsePosition& parse_pos) const;
406 
407     /**
408      * Create a default date/time formatter that uses the SHORT style for both
409      * the date and the time.
410      *
411      * @return A date/time formatter which the caller owns.
412      * @stable ICU 2.0
413      */
414     static DateFormat* U_EXPORT2 createInstance(void);
415 
416     /**
417      * Creates a time formatter with the given formatting style for the given
418      * locale.
419      *
420      * @param style     The given formatting style. For example,
421      *                  SHORT for "h:mm a" in the US locale.
422      * @param aLocale   The given locale.
423      * @return          A time formatter which the caller owns.
424      * @stable ICU 2.0
425      */
426     static DateFormat* U_EXPORT2 createTimeInstance(EStyle style = kDefault,
427                                           const Locale& aLocale = Locale::getDefault());
428 
429     /**
430      * Creates a date formatter with the given formatting style for the given
431      * const locale.
432      *
433      * @param style     The given formatting style. For example,
434      *                  SHORT for "M/d/yy" in the US locale.
435      * @param aLocale   The given locale.
436      * @return          A date formatter which the caller owns.
437      * @stable ICU 2.0
438      */
439     static DateFormat* U_EXPORT2 createDateInstance(EStyle style = kDefault,
440                                           const Locale& aLocale = Locale::getDefault());
441 
442     /**
443      * Creates a date/time formatter with the given formatting styles for the
444      * given locale.
445      *
446      * @param dateStyle The given formatting style for the date portion of the result.
447      *                  For example, SHORT for "M/d/yy" in the US locale.
448      * @param timeStyle The given formatting style for the time portion of the result.
449      *                  For example, SHORT for "h:mm a" in the US locale.
450      * @param aLocale   The given locale.
451      * @return          A date/time formatter which the caller owns.
452      * @stable ICU 2.0
453      */
454     static DateFormat* U_EXPORT2 createDateTimeInstance(EStyle dateStyle = kDefault,
455                                               EStyle timeStyle = kDefault,
456                                               const Locale& aLocale = Locale::getDefault());
457 
458     /**
459      * Gets the set of locales for which DateFormats are installed.
460      * @param count Filled in with the number of locales in the list that is returned.
461      * @return the set of locales for which DateFormats are installed.  The caller
462      *  does NOT own this list and must not delete it.
463      * @stable ICU 2.0
464      */
465     static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
466 
467     /**
468      * Returns true if the formatter is set for lenient parsing.
469      * @stable ICU 2.0
470      */
471     virtual UBool isLenient(void) const;
472 
473     /**
474      * Specify whether or not date/time parsing is to be lenient. With lenient
475      * parsing, the parser may use heuristics to interpret inputs that do not
476      * precisely match this object's format. With strict parsing, inputs must
477      * match this object's format.
478      *
479      * @param lenient  True specifies date/time interpretation to be lenient.
480      * @see Calendar::setLenient
481      * @stable ICU 2.0
482      */
483     virtual void setLenient(UBool lenient);
484 
485     /**
486      * Gets the calendar associated with this date/time formatter.
487      * @return the calendar associated with this date/time formatter.
488      * @stable ICU 2.0
489      */
490     virtual const Calendar* getCalendar(void) const;
491 
492     /**
493      * Set the calendar to be used by this date format. Initially, the default
494      * calendar for the specified or default locale is used.  The caller should
495      * not delete the Calendar object after it is adopted by this call.
496      * Adopting a new calendar will change to the default symbols.
497      *
498      * @param calendarToAdopt    Calendar object to be adopted.
499      * @stable ICU 2.0
500      */
501     virtual void adoptCalendar(Calendar* calendarToAdopt);
502 
503     /**
504      * Set the calendar to be used by this date format. Initially, the default
505      * calendar for the specified or default locale is used.
506      *
507      * @param newCalendar Calendar object to be set.
508      * @stable ICU 2.0
509      */
510     virtual void setCalendar(const Calendar& newCalendar);
511 
512 
513     /**
514      * Gets the number formatter which this date/time formatter uses to format
515      * and parse the numeric portions of the pattern.
516      * @return the number formatter which this date/time formatter uses.
517      * @stable ICU 2.0
518      */
519     virtual const NumberFormat* getNumberFormat(void) const;
520 
521     /**
522      * Allows you to set the number formatter.  The caller should
523      * not delete the NumberFormat object after it is adopted by this call.
524      * @param formatToAdopt     NumberFormat object to be adopted.
525      * @stable ICU 2.0
526      */
527     virtual void adoptNumberFormat(NumberFormat* formatToAdopt);
528 
529     /**
530      * Allows you to set the number formatter.
531      * @param newNumberFormat  NumberFormat object to be set.
532      * @stable ICU 2.0
533      */
534     virtual void setNumberFormat(const NumberFormat& newNumberFormat);
535 
536     /**
537      * Returns a reference to the TimeZone used by this DateFormat's calendar.
538      * @return the time zone associated with the calendar of DateFormat.
539      * @stable ICU 2.0
540      */
541     virtual const TimeZone& getTimeZone(void) const;
542 
543     /**
544      * Sets the time zone for the calendar of this DateFormat object. The caller
545      * no longer owns the TimeZone object and should not delete it after this call.
546      * @param zoneToAdopt the TimeZone to be adopted.
547      * @stable ICU 2.0
548      */
549     virtual void adoptTimeZone(TimeZone* zoneToAdopt);
550 
551     /**
552      * Sets the time zone for the calendar of this DateFormat object.
553      * @param zone the new time zone.
554      * @stable ICU 2.0
555      */
556     virtual void setTimeZone(const TimeZone& zone);
557 
558 protected:
559     /**
560      * Default constructor.  Creates a DateFormat with no Calendar or NumberFormat
561      * associated with it.  This constructor depends on the subclasses to fill in
562      * the calendar and numberFormat fields.
563      * @stable ICU 2.0
564      */
565     DateFormat();
566 
567     /**
568      * Copy constructor.
569      * @stable ICU 2.0
570      */
571     DateFormat(const DateFormat&);
572 
573     /**
574      * Default assignment operator.
575      * @stable ICU 2.0
576      */
577     DateFormat& operator=(const DateFormat&);
578 
579     /**
580      * The calendar that DateFormat uses to produce the time field values needed
581      * to implement date/time formatting. Subclasses should generally initialize
582      * this to the default calendar for the locale associated with this DateFormat.
583      * @stable ICU 2.4
584      */
585     Calendar* fCalendar;
586 
587     /**
588      * The number formatter that DateFormat uses to format numbers in dates and
589      * times. Subclasses should generally initialize this to the default number
590      * format for the locale associated with this DateFormat.
591      * @stable ICU 2.4
592      */
593     NumberFormat* fNumberFormat;
594 
595 private:
596     /**
597      * Gets the date/time formatter with the given formatting styles for the
598      * given locale.
599      * @param dateStyle the given date formatting style.
600      * @param timeStyle the given time formatting style.
601      * @param inLocale the given locale.
602      * @return a date/time formatter, or 0 on failure.
603      */
604     static DateFormat* U_EXPORT2 create(EStyle timeStyle, EStyle dateStyle, const Locale&);
605 
606 public:
607     /**
608      * Field selector for FieldPosition for DateFormat fields.
609      * @obsolete ICU 3.4 use UDateFormatField instead, since this API will be
610      * removed in that release
611      */
612     enum EField
613     {
614         // Obsolete; use UDateFormatField instead
615         kEraField = UDAT_ERA_FIELD,
616         kYearField = UDAT_YEAR_FIELD,
617         kMonthField = UDAT_MONTH_FIELD,
618         kDateField = UDAT_DATE_FIELD,
619         kHourOfDay1Field = UDAT_HOUR_OF_DAY1_FIELD,
620         kHourOfDay0Field = UDAT_HOUR_OF_DAY0_FIELD,
621         kMinuteField = UDAT_MINUTE_FIELD,
622         kSecondField = UDAT_SECOND_FIELD,
623         kMillisecondField = UDAT_FRACTIONAL_SECOND_FIELD,
624         kDayOfWeekField = UDAT_DAY_OF_WEEK_FIELD,
625         kDayOfYearField = UDAT_DAY_OF_YEAR_FIELD,
626         kDayOfWeekInMonthField = UDAT_DAY_OF_WEEK_IN_MONTH_FIELD,
627         kWeekOfYearField = UDAT_WEEK_OF_YEAR_FIELD,
628         kWeekOfMonthField = UDAT_WEEK_OF_MONTH_FIELD,
629         kAmPmField = UDAT_AM_PM_FIELD,
630         kHour1Field = UDAT_HOUR1_FIELD,
631         kHour0Field = UDAT_HOUR0_FIELD,
632         kTimezoneField = UDAT_TIMEZONE_FIELD,
633         kYearWOYField = UDAT_YEAR_WOY_FIELD,
634         kDOWLocalField = UDAT_DOW_LOCAL_FIELD,
635         kExtendedYearField = UDAT_EXTENDED_YEAR_FIELD,
636         kJulianDayField = UDAT_JULIAN_DAY_FIELD,
637         kMillisecondsInDayField = UDAT_MILLISECONDS_IN_DAY_FIELD,
638 
639         // Obsolete; use UDateFormatField instead
640         ERA_FIELD = UDAT_ERA_FIELD,
641         YEAR_FIELD = UDAT_YEAR_FIELD,
642         MONTH_FIELD = UDAT_MONTH_FIELD,
643         DATE_FIELD = UDAT_DATE_FIELD,
644         HOUR_OF_DAY1_FIELD = UDAT_HOUR_OF_DAY1_FIELD,
645         HOUR_OF_DAY0_FIELD = UDAT_HOUR_OF_DAY0_FIELD,
646         MINUTE_FIELD = UDAT_MINUTE_FIELD,
647         SECOND_FIELD = UDAT_SECOND_FIELD,
648         MILLISECOND_FIELD = UDAT_FRACTIONAL_SECOND_FIELD,
649         DAY_OF_WEEK_FIELD = UDAT_DAY_OF_WEEK_FIELD,
650         DAY_OF_YEAR_FIELD = UDAT_DAY_OF_YEAR_FIELD,
651         DAY_OF_WEEK_IN_MONTH_FIELD = UDAT_DAY_OF_WEEK_IN_MONTH_FIELD,
652         WEEK_OF_YEAR_FIELD = UDAT_WEEK_OF_YEAR_FIELD,
653         WEEK_OF_MONTH_FIELD = UDAT_WEEK_OF_MONTH_FIELD,
654         AM_PM_FIELD = UDAT_AM_PM_FIELD,
655         HOUR1_FIELD = UDAT_HOUR1_FIELD,
656         HOUR0_FIELD = UDAT_HOUR0_FIELD,
657         TIMEZONE_FIELD = UDAT_TIMEZONE_FIELD
658     };
659 };
660 
661 inline UnicodeString&
format(const Formattable & obj,UnicodeString & appendTo,UErrorCode & status)662 DateFormat::format(const Formattable& obj,
663                    UnicodeString& appendTo,
664                    UErrorCode& status) const {
665     return Format::format(obj, appendTo, status);
666 }
667 U_NAMESPACE_END
668 
669 #endif /* #if !UCONFIG_NO_FORMATTING */
670 
671 #endif // _DATEFMT
672 //eof
673