API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.text. DateFormat View Source
Author(s)
Mark Davis, Chen-Lieh Huang, Alan Liu
Since
Version
1.57 11/17/05
Serial
Hierarchy
 Object
      Format
          DateFormat
Implements
Subclasses
Description
publicabstract abstract class DateFormat
  DateFormat is an abstract class for date/time formatting subclasses which formats and parses dates or time in a language-independent manner.
Constructors
protected DateFormat ()
Create a new date format.
Methods
Hide/Show inherited methods
public Object clone () [Overrides Format]
Overrides Cloneable
pack-private AttributedCharacterIterator createAttributedCharacterIterator (AttributedCharacterIterator iterators) [Inherited From Format]
  Creates an AttributedCharacterIterator containg the concatenated contents of the passed in AttributedCharacterIterators.
pack-private AttributedCharacterIterator createAttributedCharacterIterator (AttributedCharacterIterator iterator, Attribute key, Object value) [Inherited From Format]
  Creates an AttributedCharacterIterator with the contents of iterator and the additional attribute key value.
pack-private AttributedCharacterIterator createAttributedCharacterIterator (String s) [Inherited From Format]
  Creates an AttributedCharacterIterator for the String s.
pack-private AttributedCharacterIterator createAttributedCharacterIterator (String string, Attribute key, Object value) [Inherited From Format]
  Returns an AttributedCharacterIterator with the String string and additional key/value pair key, value.
public boolean equals (Object obj)
Overrides equals
publicfinal String format (Date date)
  Formats a Date into a date/time string.
publicabstract StringBuffer format (Date date, StringBuffer toAppendTo, FieldPosition fieldPosition)
  Formats a Date into a date/time string.
publicfinal String format (Object obj) [Inherited From Format]
  Formats an object to produce a string.
publicfinal StringBuffer format (Object obj, StringBuffer toAppendTo, FieldPosition fieldPosition) [Specified in Format]
  Overrides Format.
public AttributedCharacterIterator formatToCharacterIterator (Object obj) [Inherited From Format]
  Formats an Object producing an AttributedCharacterIterator.
publicstatic Locale getAvailableLocales ()
  Returns an array of all locales for which the get*Instance methods of this class can return localized instances.
public Calendar getCalendar ()
  Gets the calendar associated with this date/time formatter.
publicfinalstatic DateFormat getDateInstance ()
  Gets the date formatter with the default formatting style for the default locale.
publicfinalstatic DateFormat getDateInstance (int style)
  Gets the date formatter with the given formatting style for the default locale.
publicfinalstatic DateFormat getDateInstance (int style, Locale aLocale)
  Gets the date formatter with the given formatting style for the given locale.
publicfinalstatic DateFormat getDateTimeInstance ()
  Gets the date/time formatter with the default formatting style for the default locale.
publicfinalstatic DateFormat getDateTimeInstance (int dateStyle, int timeStyle)
  Gets the date/time formatter with the given date and time formatting styles for the default locale.
publicfinalstatic DateFormat getDateTimeInstance (int dateStyle, int timeStyle, Locale aLocale)
  Gets the date/time formatter with the given formatting styles for the given locale.
publicfinalstatic DateFormat getInstance ()
Get a default date/time formatter that uses the SHORT style for both the date and the time.
public NumberFormat getNumberFormat ()
  Gets the number formatter which this date/time formatter uses to format and parse a time.
publicfinalstatic DateFormat getTimeInstance ()
  Gets the time formatter with the default formatting style for the default locale.
publicfinalstatic DateFormat getTimeInstance (int style)
  Gets the time formatter with the given formatting style for the default locale.
publicfinalstatic DateFormat getTimeInstance (int style, Locale aLocale)
  Gets the time formatter with the given formatting style for the given locale.
public TimeZone getTimeZone ()
  Gets the time zone.
public int hashCode ()
Overrides hashCode
public boolean isLenient ()
Tell whether date/time parsing is to be lenient.
public Date parse (String source) throws ParseException
  Parses text from the beginning of the given string to produce a date.
publicabstract Date parse (String source, ParsePosition pos)
  Parse a date/time string according to the given parse position.
public Object parseObject (String source) throws ParseException [Inherited From Format]
  Parses text from the beginning of the given string to produce an object.
public Object parseObject (String source, ParsePosition pos) [Specified in Format]
  Parses text from a string to produce a Date.
public void setCalendar (Calendar newCalendar)
  Set the calendar to be used by this date format.
public void setLenient (boolean lenient)
  Specify whether or not date/time parsing is to be lenient.
public void setNumberFormat (NumberFormat newNumberFormat)
  Allows you to set the number formatter.
public void setTimeZone (TimeZone zone)
  Sets the time zone for the calendar of this DateFormat object.
Fields
Hide/Show inherited fields
publicfinalstatic int AM_PM_FIELD = "14"
  Useful constant for AM_PM field alignment.
protected Calendar calendar
  The calendar that DateFormat uses to produce the time field values needed to implement date and time formatting.
publicfinalstatic int DATE_FIELD = "3"
  Useful constant for DATE field alignment.
publicfinalstatic int DAY_OF_WEEK_FIELD = "9"
  Useful constant for DAY_OF_WEEK field alignment.
publicfinalstatic int DAY_OF_WEEK_IN_MONTH_FIELD = "11"
  Useful constant for DAY_OF_WEEK_IN_MONTH field alignment.
publicfinalstatic int DAY_OF_YEAR_FIELD = "10"
  Useful constant for DAY_OF_YEAR field alignment.
publicfinalstatic int DEFAULT = "2"
  Constant for default style pattern.
publicfinalstatic int ERA_FIELD = "0"
  Useful constant for ERA field alignment.
publicfinalstatic int FULL = "0"
Constant for full style pattern.
publicfinalstatic int HOUR_OF_DAY0_FIELD = "5"
  Useful constant for zero-based HOUR_OF_DAY field alignment.
publicfinalstatic int HOUR_OF_DAY1_FIELD = "4"
  Useful constant for one-based HOUR_OF_DAY field alignment.
publicfinalstatic int HOUR0_FIELD = "16"
  Useful constant for zero-based HOUR field alignment.
publicfinalstatic int HOUR1_FIELD = "15"
  Useful constant for one-based HOUR field alignment.
publicfinalstatic int LONG = "1"
Constant for long style pattern.
publicfinalstatic int MEDIUM = "2"
Constant for medium style pattern.
publicfinalstatic int MILLISECOND_FIELD = "8"
  Useful constant for MILLISECOND field alignment.
publicfinalstatic int MINUTE_FIELD = "6"
  Useful constant for MINUTE field alignment.
publicfinalstatic int MONTH_FIELD = "2"
  Useful constant for MONTH field alignment.
protected NumberFormat numberFormat
  The number formatter that DateFormat uses to format numbers in dates and times.
publicfinalstatic int SECOND_FIELD = "7"
  Useful constant for SECOND field alignment.
publicfinalstatic int SHORT = "3"
Constant for short style pattern.
publicfinalstatic int TIMEZONE_FIELD = "17"
  Useful constant for TIMEZONE field alignment.
publicfinalstatic int WEEK_OF_MONTH_FIELD = "13"
  Useful constant for WEEK_OF_MONTH field alignment.
publicfinalstatic int WEEK_OF_YEAR_FIELD = "12"
  Useful constant for WEEK_OF_YEAR field alignment.
publicfinalstatic int YEAR_FIELD = "1"
  Useful constant for YEAR field alignment.
Nested Classes
  DateFormat.Field
Defines constants that are used as attribute keys in the AttributedCharacterIterator returned from DateFormat.formatToCharacterIterator and as field identifiers in FieldPosition.
  Format.Field
Defines constants that are used as attribute keys in the AttributedCharacterIterator returned from Format.formatToCharacterIterator and as field identifiers in FieldPosition.
  Format.FieldDelegate
FieldDelegate is notified by the various Format implementations as they are formatting the Objects.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar