home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / DateFormat.java < prev    next >
Text File  |  1997-05-20  |  22KB  |  616 lines

  1. /*
  2.  * @(#)DateFormat.java    1.20 97/02/05
  3.  *
  4.  * (C) Copyright Taligent, Inc. 1996 - All Rights Reserved
  5.  * (C) Copyright IBM Corp. 1996 - All Rights Reserved
  6.  *
  7.  * Portions copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved.
  8.  *
  9.  *   The original version of this source code and documentation is copyrighted
  10.  * and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These
  11.  * materials are provided under terms of a License Agreement between Taligent
  12.  * and Sun. This technology is protected by multiple US and International
  13.  * patents. This notice and attribution to Taligent may not be removed.
  14.  *   Taligent is a registered trademark of Taligent, Inc.
  15.  *
  16.  * Permission to use, copy, modify, and distribute this software
  17.  * and its documentation for NON-COMMERCIAL purposes and without
  18.  * fee is hereby granted provided that this copyright notice
  19.  * appears in all copies. Please refer to the file "copyright.html"
  20.  * for further important copyright and licensing information.
  21.  *
  22.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  23.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  24.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  25.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  26.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  27.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  28.  *
  29.  */
  30.  
  31. package java.text;
  32. import java.util.Locale;
  33. import java.util.ResourceBundle;
  34. import java.util.MissingResourceException;
  35. import java.util.TimeZone;
  36. import java.util.SimpleTimeZone;
  37. import java.util.Calendar;
  38. import java.util.GregorianCalendar;
  39. import java.util.Date;
  40. import java.text.resources.*;
  41.  
  42. /**
  43.  * DateFormat is an abstract class for date/time formatting subclasses which
  44.  * formats and parses dates or time in a language-independent manner.
  45.  * The date/time formatting subclass, such as SimpleDateFormat, allows for
  46.  * formatting (i.e., millis -> text), parsing (text -> millis), and
  47.  * normalization. Formats/Parses a date or time, which is the standard millis
  48.  * since 24:00 GMT, Jan 1, 1970
  49.  *
  50.  * <p>DateFormat provides many class methods for obtaining default date/time
  51.  * formatters based on the default or a given loacle and a number of formatting
  52.  * styles. The formatting styles include FULL, LONG, MEDIUM, and SHORT. More
  53.  * detail and examples of using these styles are provided in the method
  54.  * descriptions.
  55.  *
  56.  * <p>DateFormat helps you to format and parse dates for any locale.
  57.  * Your code can be completely independent of the locale conventions for
  58.  * months, days of the week, or even the calendar format: lunar vs. solar.
  59.  *
  60.  * <p>To format a date for the current Locale, use one of the
  61.  * static factory methods:
  62.  * <pre>
  63.  *  myString = DateFormat.getDateInstance().format(myDate);
  64.  * </pre>
  65.  * <p>If you are formatting multiple numbers, it is
  66.  * more efficient to get the format and use it multiple times so that
  67.  * the system doesn't have to fetch the information about the local
  68.  * language and country conventions multiple times.
  69.  * <pre>
  70.  *  DateFormat df = DateFormat.getDateInstance();
  71.  *  for (int i = 0; i < a.length; ++i) {
  72.  *    output.println(df.format(myDate[i]) + "; ");
  73.  *  }
  74.  * </pre>
  75.  * <p>To format a number for a different Locale, specify it in the
  76.  * call to getDateInstance().
  77.  * <pre>
  78.  *  DateFormat df = DateFormat.getDateInstance(Locale.FRANCE);
  79.  * </pre>
  80.  * <p>You can use a DateFormat to parse also.
  81.  * <pre>
  82.  *  myDate = df.parse(myString);
  83.  * </pre>
  84.  * <p>Use getDate to get the normal date format for that country.
  85.  * There are other static factory methods available.
  86.  * Use getTime to get the time format for that country.
  87.  * Use getDateTime to get a date and time format. You can pass in different
  88.  * options to these factory methods to control the length of the
  89.  * result; from SHORT to MEDIUM to LONG to FULL. The exact result depends
  90.  * on the locale, but generally:
  91.  * <ul><li>SHORT is completely numeric, such as 12.13.52 or 3:30pm
  92.  * <li>MEDIUM is longer, such as Jan 12, 1952
  93.  * <li>LONG is longer, such as January 12, 1952 or 3:30:32pm
  94.  * <li>FULL is pretty completely specified, such as
  95.  * Tuesday, April 12, 1952 AD or 3:30:42pm PST.
  96.  * </ul>
  97.  *
  98.  * <p>You can also set the time zone on the format if you wish.
  99.  * If you want even more control over the format or parsing,
  100.  * (or want to give your users more control),
  101.  * you can try casting the DateFormat you get from the factory methods
  102.  * to a SimpleDateFormat. This will work for the majority
  103.  * of countries; just remember to put it in a try block in case you
  104.  * encounter an unusual one.
  105.  *
  106.  * <p>You can also use forms of the parse and format methods with
  107.  * ParsePosition and FieldPosition to
  108.  * allow you to
  109.  * <ul><li>pregressively parse through pieces of a string.
  110.  * <li>align any particular field, or find out where it is for selection
  111.  * on the screen.
  112.  * </ul>
  113.  *
  114.  * @see          Format
  115.  * @see          NumberFormat
  116.  * @see          SimpleDateFormat
  117.  * @see          java.util.Calendar
  118.  * @see          java.util.GregorianCalendar
  119.  * @see          java.util.TimeZone
  120.  * @version      1.20 02/05/97
  121.  * @author       Mark Davis, Chen-Lieh Huang
  122.  */
  123. public abstract class DateFormat extends Format implements Cloneable {
  124.  
  125.     /**
  126.      * The calendar that DateFormat uses to produce the time field values
  127.      * needed to implement date/time formatting.  Subclasses should initialize
  128.      * this to the default calendar for the locale associated with this
  129.      * DateFormat.
  130.      */
  131.     protected Calendar calendar;
  132.  
  133.     /**
  134.      * The number formatter that DateFormat uses to format numbers in dates
  135.      * and times.  Subclasses should initialize this to the default number
  136.      * format for the locale associated with this DateFormat.
  137.      */
  138.     protected NumberFormat numberFormat;
  139.  
  140.     /**
  141.      * Useful constant for ERA field alignment.
  142.      * Used in FieldPosition of date/time formatting.
  143.      */
  144.     public final static int ERA_FIELD = 0;
  145.     /**
  146.      * Useful constant for YEAR field alignment.
  147.      * Used in FieldPosition of date/time formatting.
  148.      */
  149.     public final static int YEAR_FIELD = 1;
  150.     /**
  151.      * Useful constant for MONTH field alignment.
  152.      * Used in FieldPosition of date/time formatting.
  153.      */
  154.     public final static int MONTH_FIELD = 2;
  155.     /**
  156.      * Useful constant for DATE field alignment.
  157.      * Used in FieldPosition of date/time formatting.
  158.      */
  159.     public final static int DATE_FIELD = 3;
  160.     /**
  161.      * Useful constant for one-based HOUR_OF_DAY field alignment.
  162.      * Used in FieldPosition of date/time formatting.
  163.      * HOUR_OF_DAY1_FIELD is used for the one-based 24-hour clock.
  164.      * For example, 23:59 + 01:00 results in 24:59.
  165.      */
  166.     public final static int HOUR_OF_DAY1_FIELD = 4;
  167.     /**
  168.      * Useful constant for zero-based HOUR_OF_DAY field alignment.
  169.      * Used in FieldPosition of date/time formatting.
  170.      * HOUR_OF_DAY0_FIELD is used for the zero-based 24-hour clock.
  171.      * For example, 23:59 + 01:00 results in 00:59.
  172.      */
  173.     public final static int HOUR_OF_DAY0_FIELD = 5;
  174.     /**
  175.      * Useful constant for MINUTE field alignment.
  176.      * Used in FieldPosition of date/time formatting.
  177.      */
  178.     public final static int MINUTE_FIELD = 6;
  179.     /**
  180.      * Useful constant for SECOND field alignment.
  181.      * Used in FieldPosition of date/time formatting.
  182.      */
  183.     public final static int SECOND_FIELD = 7;
  184.     /**
  185.      * Useful constant for MILLISECOND field alignment.
  186.      * Used in FieldPosition of date/time formatting.
  187.      */
  188.     public final static int MILLISECOND_FIELD = 8;
  189.     /**
  190.      * Useful constant for DAY_OF_WEEK field alignment.
  191.      * Used in FieldPosition of date/time formatting.
  192.      */
  193.     public final static int DAY_OF_WEEK_FIELD = 9;
  194.     /**
  195.      * Useful constant for DAY_OF_YEAR field alignment.
  196.      * Used in FieldPosition of date/time formatting.
  197.      */
  198.     public final static int DAY_OF_YEAR_FIELD = 10;
  199.     /**
  200.      * Useful constant for DAY_OF_WEEK_IN_MONTH field alignment.
  201.      * Used in FieldPosition of date/time formatting.
  202.      */
  203.     public final static int DAY_OF_WEEK_IN_MONTH_FIELD = 11;
  204.     /**
  205.      * Useful constant for WEEK_OF_YEAR field alignment.
  206.      * Used in FieldPosition of date/time formatting.
  207.      */
  208.     public final static int WEEK_OF_YEAR_FIELD = 12;
  209.     /**
  210.      * Useful constant for WEEK_OF_MONTH field alignment.
  211.      * Used in FieldPosition of date/time formatting.
  212.      */
  213.     public final static int WEEK_OF_MONTH_FIELD = 13;
  214.     /**
  215.      * Useful constant for AM_PM field alignment.
  216.      * Used in FieldPosition of date/time formatting.
  217.      */
  218.     public final static int AM_PM_FIELD = 14;
  219.     /**
  220.      * Useful constant for one-based HOUR field alignment.
  221.      * Used in FieldPosition of date/time formatting.
  222.      * HOUR1_FIELD is used for the one-based 12-hour clock.
  223.      * For example, 11:30 PM + 1 hour results in 12:30 AM.
  224.      */
  225.     public final static int HOUR1_FIELD = 15;
  226.     /**
  227.      * Useful constant for zero-based HOUR field alignment.
  228.      * Used in FieldPosition of date/time formatting.
  229.      * HOUR0_FIELD is used for the zero-based 12-hour clock.
  230.      * For example, 11:30 PM + 1 hour results in 00:30 AM.
  231.      */
  232.     public final static int HOUR0_FIELD = 16;
  233.     /**
  234.      * Useful constant for TIMEZONE field alignment.
  235.      * Used in FieldPosition of date/time formatting.
  236.      */
  237.     public final static int TIMEZONE_FIELD = 17;
  238.  
  239.     /**
  240.      * Overrides Format.
  241.      * Formats a time object into a time string. Examples of time objects
  242.      * are a time value expressed in milliseconds and a Date object.
  243.      * @param obj must be a Number or a Date.
  244.      * @param toAppendTo the string buffer for the returning time string.
  245.      * @param status the formatting status. On input: an alignment field,
  246.      * if desired. On output: the offsets of the alignment field.
  247.      * @return the formatted time string.
  248.      * @see java.util.Format
  249.      */
  250.     public final StringBuffer format(Object obj, StringBuffer toAppendTo,
  251.                                      FieldPosition fieldPosition)
  252.     {
  253.         if (obj instanceof Number)
  254.             return format( new Date(((Number)obj).longValue()),
  255.                           toAppendTo, fieldPosition );
  256.         else if (obj instanceof Date)
  257.             return format( (Date)obj, toAppendTo, fieldPosition );
  258.     else
  259.         throw new IllegalArgumentException("Cannot format given Object as a Date");
  260.     }
  261.  
  262.     /**
  263.      * Formats a Date into a date/time string.
  264.      * @param date a Date to be formatted into a date/time string.
  265.      * @param toAppendTo the string buffer for the returning date/time string.
  266.      * @param status the formatting status. On input: an alignment field,
  267.      * if desired. On output: the offsets of the alignment field. For
  268.      * example, given a time text "1996.07.10 AD at 15:08:56 PDT",
  269.      * if the given status.field is DateFormat.YEAR_FIELD, the offsets
  270.      * status.beginIndex and status.getEndIndex will be set to 0 and 4,
  271.      * respectively. Notice that if the same time field appears
  272.      * more than once in a pattern, the status will be set for the first
  273.      * occurence of that time field. For instance, formatting a Date to
  274.      * the time string "1 PM PDT (Pacific Daylight Time)" using the pattern
  275.      * "h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD,
  276.      * the offsets status.beginIndex and status.getEndIndex will be set to
  277.      * 5 and 8, respectively, for the first occurence of the timezone
  278.      * pattern character 'z'.
  279.      * @return the formatted date/time string.
  280.      */
  281.     public abstract StringBuffer format(Date date, StringBuffer toAppendTo,
  282.                                         FieldPosition fieldPosition);
  283.  
  284.     /**
  285.      * Formats a Date into a date/time string.
  286.      * @param date the time value to be formatted into a time string.
  287.      * @return the formatted time string.
  288.      */
  289.     public final String format(Date date)
  290.     {
  291.         return format(date, new StringBuffer(),new FieldPosition(0)).toString();
  292.     }
  293.  
  294.     /**
  295.      * Parse a date/time string.
  296.      *
  297.      * @exception  ParseException  If the given string cannot be parsed as a date.
  298.      *
  299.      * @see #parse(String, ParsePosition)
  300.      */
  301.     public Date parse(String text) throws ParseException
  302.     {
  303.         ParsePosition pos = new ParsePosition(0);
  304.         Date result = parse(text, pos);
  305.         if (pos.index == 0)
  306.         throw new ParseException("Unparseable date: \"" + text + "\"" , 0);
  307.         return result;
  308.     }
  309.  
  310.     /**
  311.      * Parse a date/time string according to the given parse position.  For
  312.      * example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date
  313.      * that is equivalent to Date(837039928046).
  314.      *
  315.      * <p> By default, parsing is lenient: If the input is not in the form used
  316.      * by this object's format method but can still be parsed as a date, then
  317.      * the parse succeeds.  Clients may insist on strict adherence to the
  318.      * format by calling setLenient(false).
  319.      *
  320.      * @see java.text.DateFormat#setLenient(boolean)
  321.      *
  322.      * @param text  The date/time string to be parsed
  323.      *
  324.      * @param pos   On input, the position at which to start parsing; on
  325.      *              output, the position at which parsing terminated, or the
  326.      *              start position if the parse failed.
  327.      *
  328.      * @return      A Date, or null if the input could not be parsed
  329.      */
  330.     public abstract Date parse(String text, ParsePosition pos);
  331.  
  332.     /**
  333.      * Parse a date/time string into an Object.  This convenience method simply
  334.      * calls parse(String, ParsePosition).
  335.      *
  336.      * @see #parse(String, ParsePosition)
  337.      */
  338.     public Object parseObject (String source, ParsePosition pos)
  339.     {
  340.         return parse(source, pos);
  341.     }
  342.  
  343.     /**
  344.      * Constant for full style pattern.
  345.      */
  346.     public static final int FULL = 0;
  347.     /**
  348.      * Constant for long style pattern.
  349.      */
  350.     public static final int LONG = 1;
  351.     /**
  352.      * Constant for medium style pattern.
  353.      */
  354.     public static final int MEDIUM = 2;
  355.     /**
  356.      * Constant for short style pattern.
  357.      */
  358.     public static final int SHORT = 3;
  359.     /**
  360.      * Constant for default style pattern.
  361.      */
  362.     public static final int DEFAULT = MEDIUM;
  363.  
  364.     /**
  365.      * Gets the time formatter with the default formatting style
  366.      * for the default locale.
  367.      * @return a time formatter.
  368.      */
  369.     public final static DateFormat getTimeInstance()
  370.     {
  371.         return get(DEFAULT, -1, Locale.getDefault());
  372.     }
  373.  
  374.     /**
  375.      * Gets the time formatter with the given formatting style
  376.      * for the default locale.
  377.      * @param style the given formatting style. For example,
  378.      * SHORT for "h:mm a" in the US locale.
  379.      * @return a time formatter.
  380.      */
  381.     public final static DateFormat getTimeInstance(int style)
  382.     {
  383.         return get(style, -1, Locale.getDefault());
  384.     }
  385.  
  386.     /**
  387.      * Gets the time formatter with the given formatting style
  388.      * for the given locale.
  389.      * @param style the given formatting style. For example,
  390.      * SHORT for "h:mm a" in the US locale.
  391.      * @param inLocale the given locale.
  392.      * @return a time formatter.
  393.      */
  394.     public final static DateFormat getTimeInstance(int style,
  395.                                                  Locale aLocale)
  396.     {
  397.         return get(style, -1, aLocale);
  398.     }
  399.  
  400.     /**
  401.      * Gets the date formatter with the default formatting style
  402.      * for the default locale.
  403.      * @return a date formatter.
  404.      */
  405.     public final static DateFormat getDateInstance()
  406.     {
  407.         // +4 to set the correct index for getting data out of
  408.         // LocaleElements.
  409.         return get(-1, DEFAULT + 4, Locale.getDefault());
  410.     }
  411.  
  412.     /**
  413.      * Gets the date formatter with the given formatting style
  414.      * for the default locale.
  415.      * @param style the given formatting style. For example,
  416.      * SHORT for "M/d/yy" in the US locale.
  417.      * @return a date formatter.
  418.      */
  419.     public final static DateFormat getDateInstance(int style)
  420.     {
  421.         return get(-1, style + 4, Locale.getDefault());
  422.     }
  423.  
  424.     /**
  425.      * Gets the date formatter with the given formatting style
  426.      * for the given locale.
  427.      * @param style the given formatting style. For example,
  428.      * SHORT for "M/d/yy" in the US locale.
  429.      * @param inLocale the given locale.
  430.      * @return a date formatter.
  431.      */
  432.     public final static DateFormat getDateInstance(int style,
  433.                                                  Locale aLocale)
  434.     {
  435.         return get(-1, style + 4, aLocale);
  436.     }
  437.  
  438.     /**
  439.      * Gets the date/time formatter with the default formatting style
  440.      * for the default locale.
  441.      * @return a date/time formatter.
  442.      */
  443.     public final static DateFormat getDateTimeInstance()
  444.     {
  445.         return get(DEFAULT, DEFAULT + 4, Locale.getDefault());
  446.     }
  447.  
  448.     /**
  449.      * Gets the date/time formatter with the given date and time
  450.      * formatting styles for the default locale.
  451.      * @param dateStyle the given date formatting style. For example,
  452.      * SHORT for "M/d/yy" in the US locale.
  453.      * @param timeStyle the given time formatting style. For example,
  454.      * SHORT for "h:mm a" in the US locale.
  455.      * @return a date/time formatter.
  456.      */
  457.     public final static DateFormat getDateTimeInstance(int dateStyle,
  458.                                                        int timeStyle)
  459.     {
  460.         return get(timeStyle, dateStyle + 4, Locale.getDefault());
  461.     }
  462.  
  463.     /**
  464.      * Gets the date/time formatter with the given formatting styles
  465.      * for the given locale.
  466.      * @param dateStyle the given date formatting style.
  467.      * @param timeStyle the given time formatting style.
  468.      * @param inLocale the given locale.
  469.      * @return a date/time formatter.
  470.      */
  471.     public final static DateFormat
  472.         getDateTimeInstance(int dateStyle, int timeStyle, Locale aLocale)
  473.     {
  474.         return get(timeStyle, dateStyle + 4, aLocale);
  475.     }
  476.  
  477.     /**
  478.      * Get a default date/time formatter that uses the SHORT style for both the
  479.      * date and the time.
  480.      */
  481.     public final static DateFormat getInstance() {
  482.     return getDateTimeInstance(SHORT, SHORT);
  483.     }
  484.  
  485.     /**
  486.      * Gets the set of locales for which DateFormats are installed.
  487.      * @return the set of locales for which DateFormats are installed.
  488.      */
  489.     public static Locale[] getAvailableLocales()
  490.     {
  491.         return LocaleData.getAvailableLocales("DateTimePatterns");
  492.     }
  493.  
  494.     /**
  495.      * Set the calendar to be used by this date format.  Initially, the default
  496.      * calendar for the specified or default locale is used.
  497.      */
  498.     public void setCalendar(Calendar newCalendar)
  499.     {
  500.         this.calendar = newCalendar;
  501.     }
  502.  
  503.     /**
  504.      * Gets the calendar associated with this date/time formatter.
  505.      * @return the calendar associated with this date/time formatter.
  506.      */
  507.     public Calendar getCalendar()
  508.     {
  509.         return calendar;
  510.     }
  511.  
  512.     /**
  513.      * Allows you to set the number formatter.
  514.      * @param newNumberFormat the given new NumberFormat.
  515.      */
  516.     public void setNumberFormat(NumberFormat newNumberFormat)
  517.     {
  518.         this.numberFormat = newNumberFormat;
  519.     }
  520.  
  521.     /**
  522.      * Gets the number formatter which this date/time formatter uses to
  523.      * format and parse a time.
  524.      * @return the number formatter which this date/time formatter uses.
  525.      */
  526.     public NumberFormat getNumberFormat()
  527.     {
  528.         return numberFormat;
  529.     }
  530.  
  531.     /**
  532.      * Sets the time zone for the calendar of this DateFormat object.
  533.      * @param zone the given new time zone.
  534.      */
  535.     public void setTimeZone(TimeZone zone)
  536.     {
  537.         calendar.setTimeZone(zone);
  538.     }
  539.  
  540.     /**
  541.      * Gets the time zone.
  542.      * @return the time zone associated with the calendar of DateFormat.
  543.      */
  544.     public TimeZone getTimeZone()
  545.     {
  546.         return calendar.getTimeZone();
  547.     }
  548.  
  549.     /**
  550.      * Specify whether or not date/time parsing is to be lenient.  With
  551.      * lenient parsing, the parser may use heuristics to interpret inputs that
  552.      * do not precisely match this object's format.  With strict parsing,
  553.      * inputs must match this object's format.
  554.      * @see java.util.Calendar#setLenient
  555.      */
  556.     public void setLenient(boolean lenient)
  557.     {
  558.         calendar.setLenient(lenient);
  559.     }
  560.  
  561.     /**
  562.      * Tell whether date/time parsing is to be lenient.
  563.      */
  564.     public boolean isLenient()
  565.     {
  566.         return calendar.isLenient();
  567.     }
  568.  
  569.     /**
  570.      * Overrides hashCode
  571.      */
  572.     public int hashCode() {
  573.         return numberFormat.hashCode();
  574.         // just enough fields for a reasonable distribution
  575.     }
  576.  
  577.     /**
  578.      * Overrides equals
  579.      */
  580.     public boolean equals(Object obj) {
  581.         if (this == obj) return true;
  582.         if (getClass() != obj.getClass()) return false;
  583.         DateFormat other = (DateFormat) obj;
  584.         return (calendar.equals(other.calendar)
  585.             && numberFormat.equals(other.numberFormat));
  586.     }
  587.  
  588.     /**
  589.      * Overrides Cloneable
  590.      */
  591.     public Object clone()
  592.     {
  593.         DateFormat other = (DateFormat) super.clone();
  594.         other.calendar = (Calendar) calendar.clone();
  595.         other.numberFormat = (NumberFormat) numberFormat.clone();
  596.         return other;
  597.     }
  598.  
  599.     private static DateFormat get(int timeStyle, /* -1 for no time */
  600.                                   int dateStyle, /* -1 for no date */
  601.                                   Locale loc) {
  602.     try {
  603.             ResourceBundle resource
  604.         = ResourceBundle.getBundle
  605.         ("java.text.resources.LocaleElements", loc);
  606.         return new SimpleDateFormat(timeStyle, dateStyle, loc);
  607.  
  608.         } catch (MissingResourceException e) {
  609.             return new SimpleDateFormat("M/d/yy h:mm a");
  610.         }
  611.     }
  612.  
  613.     protected DateFormat() { }
  614.  
  615. }
  616.