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
-
millisPerHour
- Useful constant for defining timezone offsets.
-
DateFormatData()
- Constructs a DateFormatData by loading format data from resources
based on the default locale.
-
DateFormatData(Locale)
- Constructs a DateFormatData by loading format data from resources
based on the given locale.
-
clone()
- Overrides Cloneable
-
equals(Object)
- Compares the equality of two DateFormatData objects.
-
getAmpms()
- Gets ampm strings.
-
getEras()
- Gets era strings.
-
getLocalPatternChars()
- Gets localized date-time pattern characters.
-
getMonths()
- Gets month strings.
-
getShortMonths()
- Gets short month strings.
-
getShortWeekdays()
- Gets short weekday strings.
-
getWeekdays()
- Gets weekday strings.
-
getZoneStrings()
- Gets timezone strings.
-
hashCode()
- Override hashCode.
-
setAmpms(String[])
- Sets ampm strings.
-
setEras(String[])
- Sets era strings.
-
setLocalPatternChars(String)
- Sets localized date-time pattern characters.
-
setMonths(String[])
- Sets month strings.
-
setPatternLocalized(boolean)
- Sets to use or not to use localized date-time pattern characters.
-
setShortMonths(String[])
- Sets short month strings.
-
setShortWeekdays(String[])
- Sets short weekday strings.
-
setWeekdays(String[])
- Sets weekday strings.
-
setZoneStrings(String[][])
- Sets timezone strings.
-
useLocalizedPattern()
- Determines if the DateFormatData object uses localized date-time
pattern characters.
millisPerHour
protected final static int millisPerHour
- Useful constant for defining timezone offsets.
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.
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.
getEras
public String[] getEras()
- Gets era strings. For example: "AD" and "BC".
- Returns:
- the era strings.
setEras
public void setEras(String newEras[])
- Sets era strings. For example: "AD" and "BC".
- Parameters:
- newEras - the new era strings.
getMonths
public String[] getMonths()
- Gets month strings. For example: "January", "February", etc.
- Returns:
- the month strings.
setMonths
public void setMonths(String newMonths[])
- Sets month strings. For example: "January", "February", etc.
- Parameters:
- newMonths - the new month strings.
getShortMonths
public String[] getShortMonths()
- Gets short month strings. For example: "Jan", "Feb", etc.
- Returns:
- the short month strings.
setShortMonths
public void setShortMonths(String newShortMonths[])
- Sets short month strings. For example: "Jan", "Feb", etc.
- Parameters:
- newShortMonths - the new short month strings.
getWeekdays
public String[] getWeekdays()
- Gets weekday strings. For example: "Sunday", "Monday", etc.
- Returns:
- the weekday strings.
setWeekdays
public void setWeekdays(String newWeekdays[])
- Sets weekday strings. For example: "Sunday", "Monday", etc.
- Parameters:
- newWeekdays - the new weekday strings.
getShortWeekdays
public String[] getShortWeekdays()
- Gets short weekday strings. For example: "Sun", "Mon", etc.
- Returns:
- the short weekday strings.
setShortWeekdays
public void setShortWeekdays(String newShortWeekdays[])
- Sets short weekday strings. For example: "Sun", "Mon", etc.
- Parameters:
- newShortWeekdays - the new short weekday strings.
getAmpms
public String[] getAmpms()
- Gets ampm strings. For example: "AM" and "PM".
- Returns:
- the weekday strings.
setAmpms
public void setAmpms(String newAmpms[])
- Sets ampm strings. For example: "AM" and "PM".
- Parameters:
- newAmpms - the new ampm strings.
getZoneStrings
public String[][] getZoneStrings()
- Gets timezone strings.
- Returns:
- the timezone strings.
setZoneStrings
public void setZoneStrings(String newZoneStrings[][])
- Sets timezone strings.
- Parameters:
- newZoneStrings - the new timezone strings.
getLocalPatternChars
public String getLocalPatternChars()
- Gets localized date-time pattern characters. For example: 'u', 't', etc.
- Returns:
- the localized date-time pattern characters.
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.
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.
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.
clone
public Object clone()
- Overrides Cloneable
- Overrides:
- clone in class Object
hashCode
public synchronized int hashCode()
- Override hashCode.
Generates a hash code for the DateFormatData object.
- Overrides:
- hashCode in class Object
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