All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.text.DateFormatData

java.lang.Object
   |
   +----java.text.DateFormatData

public class DateFormatData
extends Object
implements Serializable, Cloneable
DateFormatData is a public class for encapsulating localizable date-time formatting data -- including timezone data. DateFormatData is used by DateFormat and SimpleDateFormat.

Rather than first creating a DateFormatData to get a date-time formatter by using a SimpleDateFormat constructor, clients are encouraged to create a date-time formatter through using getTimeFormat, getDateFormat, or getDateTimeFormat method in DateFormat. Each of these methods can return a date/time formatter initialized with a default format pattern along with the date-time formatting data for a given or default locale. After a formatter is created, clients may modify the format pattern using the setPattern function as so desired. For more information on using these formatter factory functions, see DateFormat.

If clients decide to create a date-time formatter with a desirable format pattern for a desirable locale, they can do so with new SimpleDateFormat(aPattern, new DateFormatData(aLocale)).

DateFormatData objects are clonable. When clients obtain a DateFormatData object, they can feel free to modify the date-time formatting data to using their favorate vaules. For instance, clients can replace the localized date-time format pattern characters with the ones that they feel easy to remember. Or they can change the representative cities originally picked by default to using their favorite ones.

New DateFormatData sub-classes may be added to support SimpleDateFormat for date-time formatting for additional locales.

See Also:
DateFormat, SimpleDateFormat, SimpleTimeZone

Variable Index

 o millisPerHour
Useful constant for defining timezone offsets.

Constructor Index

 o DateFormatData()
Constructs a DateFormatData by loading format data from resources based on the default locale.
 o DateFormatData(Locale)
Constructs a DateFormatData by loading format data from resources based on the given locale.

Method Index

 o clone()
Overrides Cloneable
 o equals(Object)
Compares the equality of two DateFormatData objects.
 o getAmpms()
Gets ampm strings.
 o getEras()
Gets era strings.
 o getLocalPatternChars()
Gets localized date-time pattern characters.
 o getMonths()
Gets month strings.
 o getShortMonths()
Gets short month strings.
 o getShortWeekdays()
Gets short weekday strings.
 o getWeekdays()
Gets weekday strings.
 o getZoneStrings()
Gets timezone strings.
 o hashCode()
Override hashCode.
 o setAmpms(String[])
Sets ampm strings.
 o setEras(String[])
Sets era strings.
 o setLocalPatternChars(String)
Sets localized date-time pattern characters.
 o setMonths(String[])
Sets month strings.
 o setPatternLocalized(boolean)
Sets to use or not to use localized date-time pattern characters.
 o setShortMonths(String[])
Sets short month strings.
 o setShortWeekdays(String[])
Sets short weekday strings.
 o setWeekdays(String[])
Sets weekday strings.
 o setZoneStrings(String[][])
Sets timezone strings.
 o useLocalizedPattern()
Determines if the DateFormatData object uses localized date-time pattern characters.

Variables

 o millisPerHour
  protected final static int millisPerHour
Useful constant for defining timezone offsets.

Constructors

 o DateFormatData
  public DateFormatData()
Constructs a DateFormatData by loading format data from resources based on the default locale. If the resource for the default locale is not found or fail to load the resources, you will get a MissingResourceException.

 o DateFormatData
  public DateFormatData(Locale desiredLocale)
Constructs a DateFormatData by loading format data from resources based on the given locale. If the resource for the given locale is not found or fail to load the resources, you will get a MissingResourceException.

Parameters:
desiredLocale - the given locale.

Methods

 o getEras
  public String[] getEras()
Gets era strings. For example: "AD" and "BC".

Returns:
the era strings.
 o setEras
  public void setEras(String newEras[])
Sets era strings. For example: "AD" and "BC".

Parameters:
newEras - the new era strings.
 o getMonths
  public String[] getMonths()
Gets month strings. For example: "January", "February", etc.

Returns:
the month strings.
 o setMonths
  public void setMonths(String newMonths[])
Sets month strings. For example: "January", "February", etc.

Parameters:
newMonths - the new month strings.
 o getShortMonths
  public String[] getShortMonths()
Gets short month strings. For example: "Jan", "Feb", etc.

Returns:
the short month strings.
 o setShortMonths
  public void setShortMonths(String newShortMonths[])
Sets short month strings. For example: "Jan", "Feb", etc.

Parameters:
newShortMonths - the new short month strings.
 o getWeekdays
  public String[] getWeekdays()
Gets weekday strings. For example: "Sunday", "Monday", etc.

Returns:
the weekday strings.
 o setWeekdays
  public void setWeekdays(String newWeekdays[])
Sets weekday strings. For example: "Sunday", "Monday", etc.

Parameters:
newWeekdays - the new weekday strings.
 o getShortWeekdays
  public String[] getShortWeekdays()
Gets short weekday strings. For example: "Sun", "Mon", etc.

Returns:
the short weekday strings.
 o setShortWeekdays
  public void setShortWeekdays(String newShortWeekdays[])
Sets short weekday strings. For example: "Sun", "Mon", etc.

Parameters:
newShortWeekdays - the new short weekday strings.
 o getAmpms
  public String[] getAmpms()
Gets ampm strings. For example: "AM" and "PM".

Returns:
the weekday strings.
 o setAmpms
  public void setAmpms(String newAmpms[])
Sets ampm strings. For example: "AM" and "PM".

Parameters:
newAmpms - the new ampm strings.
 o getZoneStrings
  public String[][] getZoneStrings()
Gets timezone strings.

Returns:
the timezone strings.
 o setZoneStrings
  public void setZoneStrings(String newZoneStrings[][])
Sets timezone strings.

Parameters:
newZoneStrings - the new timezone strings.
 o getLocalPatternChars
  public String getLocalPatternChars()
Gets localized date-time pattern characters. For example: 'u', 't', etc.

Returns:
the localized date-time pattern characters.
 o setLocalPatternChars
  public void setLocalPatternChars(String newLocalPatternChars)
Sets localized date-time pattern characters. For example: 'u', 't', etc.

Parameters:
newLocalPatternChars - the new localized date-time pattern characters.
 o useLocalizedPattern
  public final boolean useLocalizedPattern()
Determines if the DateFormatData object uses localized date-time pattern characters.

Returns:
true if the localized date-time pattern characters are being used in this DateFormatData object; false otherwise.
 o setPatternLocalized
  public final void setPatternLocalized(boolean localized)
Sets to use or not to use localized date-time pattern characters.

Parameters:
localized - indicate if to use (true) or not to use (false) the localized date-time pattern characters.
 o clone
  public Object clone()
Overrides Cloneable

Overrides:
clone in class Object
 o hashCode
  public synchronized int hashCode()
Override hashCode. Generates a hash code for the DateFormatData object.

Overrides:
hashCode in class Object
 o equals
  public boolean equals(Object obj)
Compares the equality of two DateFormatData objects.

Parameters:
obj - the DateFormatData object to be compared with.
Returns:
true if the given obj is the same as this DateFormatData object; false otherwise.
Overrides:
equals in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index