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