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