API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.text. SimpleDateFormat View Source
Author(s)
Mark Davis, Chen-Lieh Huang, Alan Liu
Since
Version
1.86, 11/17/05
Serial
Hierarchy
 Object
      Format
          DateFormat
              SimpleDateFormat
Implements
Subclasses
Description
public class SimpleDateFormat
  SimpleDateFormat is a concrete class for formatting and parsing dates in a locale-sensitive manner.
Constructors
public SimpleDateFormat ()
  Constructs a SimpleDateFormat using the default pattern and date format symbols for the default locale.
pack-private SimpleDateFormat (int timeStyle, int dateStyle, Locale loc)
public SimpleDateFormat (String pattern)
  Constructs a SimpleDateFormat using the given pattern and the default date format symbols for the default locale.
public SimpleDateFormat (String pattern, DateFormatSymbols formatSymbols)
  Constructs a SimpleDateFormat using the given pattern and date format symbols.
public SimpleDateFormat (String pattern, Locale locale)
  Constructs a SimpleDateFormat using the given pattern and the default date format symbols for the given locale.
Methods
Hide/Show inherited methods
public void applyLocalizedPattern (String pattern)
  Applies the given localized pattern string to this date format.
public void applyPattern (String pattern)
  Applies the given pattern string to this date format.
public Object clone () [Overrides DateFormat]
  Creates a copy of this SimpleDateFormat.
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 DateFormat]
  Compares the given object with this SimpleDateFormat for equality.
publicfinal String format (Date date) [Inherited From DateFormat]
  Formats a Date into a date/time string.
public StringBuffer format (Date date, StringBuffer toAppendTo, FieldPosition pos) [Specified in DateFormat]
  Formats the given Date into a date/time string and appends the result to the given StringBuffer.
publicfinal String format (Object obj) [Inherited From Format]
  Formats an object to produce a string.
publicfinal StringBuffer format (Object obj, StringBuffer toAppendTo, FieldPosition fieldPosition) [Inherited From DateFormat] [Specified in Format]
  Overrides Format.
public AttributedCharacterIterator formatToCharacterIterator (Object obj) [Overrides Format]
  Formats an Object producing an AttributedCharacterIterator.
public Date get2DigitYearStart ()
  Returns the beginning date of the 100-year period 2-digit years are interpreted as being within.
publicstatic Locale getAvailableLocales () [Inherited From DateFormat]
  Returns an array of all locales for which the get*Instance methods of this class can return localized instances.
public Calendar getCalendar () [Inherited From DateFormat]
  Gets the calendar associated with this date/time formatter.
public DateFormatSymbols getDateFormatSymbols ()
  Gets a copy of the date and time format symbols of this date format.
publicfinalstatic DateFormat getDateInstance () [Inherited From DateFormat]
  Gets the date formatter with the default formatting style for the default locale.
publicfinalstatic DateFormat getDateInstance (int style) [Inherited From DateFormat]
  Gets the date formatter with the given formatting style for the default locale.
publicfinalstatic DateFormat getDateInstance (int style, Locale aLocale) [Inherited From DateFormat]
  Gets the date formatter with the given formatting style for the given locale.
publicfinalstatic DateFormat getDateTimeInstance () [Inherited From DateFormat]
  Gets the date/time formatter with the default formatting style for the default locale.
publicfinalstatic DateFormat getDateTimeInstance (int dateStyle, int timeStyle) [Inherited From DateFormat]
  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) [Inherited From DateFormat]
  Gets the date/time formatter with the given formatting styles for the given locale.
publicfinalstatic DateFormat getInstance () [Inherited From DateFormat]
Get a default date/time formatter that uses the SHORT style for both the date and the time.
public NumberFormat getNumberFormat () [Inherited From DateFormat]
  Gets the number formatter which this date/time formatter uses to format and parse a time.
publicfinalstatic DateFormat getTimeInstance () [Inherited From DateFormat]
  Gets the time formatter with the default formatting style for the default locale.
publicfinalstatic DateFormat getTimeInstance (int style) [Inherited From DateFormat]
  Gets the time formatter with the given formatting style for the default locale.
publicfinalstatic DateFormat getTimeInstance (int style, Locale aLocale) [Inherited From DateFormat]
  Gets the time formatter with the given formatting style for the given locale.
public TimeZone getTimeZone () [Inherited From DateFormat]
  Gets the time zone.
public int hashCode () [Overrides DateFormat]
  Returns the hash code value for this SimpleDateFormat object.
public boolean isLenient () [Inherited From DateFormat]
Tell whether date/time parsing is to be lenient.
public Date parse (String source) throws ParseException [Inherited From DateFormat]
  Parses text from the beginning of the given string to produce a date.
public Date parse (String text, ParsePosition pos) [Specified in DateFormat]
  Parses text from a string to produce a Date.
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) [Inherited From DateFormat] [Specified in Format]
  Parses text from a string to produce a Date.
public void set2DigitYearStart (Date startDate)
  Sets the 100-year period 2-digit years will be interpreted as being in to begin on the date the user specifies.
public void setCalendar (Calendar newCalendar) [Inherited From DateFormat]
  Set the calendar to be used by this date format.
public void setDateFormatSymbols (DateFormatSymbols newFormatSymbols)
  Sets the date and time format symbols of this date format.
public void setLenient (boolean lenient) [Inherited From DateFormat]
  Specify whether or not date/time parsing is to be lenient.
public void setNumberFormat (NumberFormat newNumberFormat) [Inherited From DateFormat]
  Allows you to set the number formatter.
public void setTimeZone (TimeZone zone) [Inherited From DateFormat]
  Sets the time zone for the calendar of this DateFormat object.
public String toLocalizedPattern ()
  Returns a localized pattern string describing this date format.
public String toPattern ()
  Returns a pattern string describing this date format.
Fields
Hide/Show inherited fields
publicfinalstatic int AM_PM_FIELD = "14" [Inherited From DateFormat]
  Useful constant for AM_PM field alignment.
protected Calendar calendar [Inherited From DateFormat]
  The calendar that DateFormat uses to produce the time field values needed to implement date and time formatting.
pack-privatefinalstatic int currentSerialVersion = "1"
publicfinalstatic int DATE_FIELD = "3" [Inherited From DateFormat]
  Useful constant for DATE field alignment.
publicfinalstatic int DAY_OF_WEEK_FIELD = "9" [Inherited From DateFormat]
  Useful constant for DAY_OF_WEEK field alignment.
publicfinalstatic int DAY_OF_WEEK_IN_MONTH_FIELD = "11" [Inherited From DateFormat]
  Useful constant for DAY_OF_WEEK_IN_MONTH field alignment.
publicfinalstatic int DAY_OF_YEAR_FIELD = "10" [Inherited From DateFormat]
  Useful constant for DAY_OF_YEAR field alignment.
publicfinalstatic int DEFAULT = "2" [Inherited From DateFormat]
  Constant for default style pattern.
publicfinalstatic int ERA_FIELD = "0" [Inherited From DateFormat]
  Useful constant for ERA field alignment.
publicfinalstatic int FULL = "0" [Inherited From DateFormat]
Constant for full style pattern.
publicfinalstatic int HOUR_OF_DAY0_FIELD = "5" [Inherited From DateFormat]
  Useful constant for zero-based HOUR_OF_DAY field alignment.
publicfinalstatic int HOUR_OF_DAY1_FIELD = "4" [Inherited From DateFormat]
  Useful constant for one-based HOUR_OF_DAY field alignment.
publicfinalstatic int HOUR0_FIELD = "16" [Inherited From DateFormat]
  Useful constant for zero-based HOUR field alignment.
publicfinalstatic int HOUR1_FIELD = "15" [Inherited From DateFormat]
  Useful constant for one-based HOUR field alignment.
publicfinalstatic int LONG = "1" [Inherited From DateFormat]
Constant for long style pattern.
publicfinalstatic int MEDIUM = "2" [Inherited From DateFormat]
Constant for medium style pattern.
publicfinalstatic int MILLISECOND_FIELD = "8" [Inherited From DateFormat]
  Useful constant for MILLISECOND field alignment.
publicfinalstatic int MINUTE_FIELD = "6" [Inherited From DateFormat]
  Useful constant for MINUTE field alignment.
publicfinalstatic int MONTH_FIELD = "2" [Inherited From DateFormat]
  Useful constant for MONTH field alignment.
protected NumberFormat numberFormat [Inherited From DateFormat]
  The number formatter that DateFormat uses to format numbers in dates and times.
publicfinalstatic int SECOND_FIELD = "7" [Inherited From DateFormat]
  Useful constant for SECOND field alignment.
pack-privatefinalstatic long serialVersionUID = "4774881970558875024"
publicfinalstatic int SHORT = "3" [Inherited From DateFormat]
Constant for short style pattern.
publicfinalstatic int TIMEZONE_FIELD = "17" [Inherited From DateFormat]
  Useful constant for TIMEZONE field alignment.
pack-privatetransient boolean useDateFormatSymbols
  Indicates whether this SimpleDateFormat should use the DateFormatSymbols.
publicfinalstatic int WEEK_OF_MONTH_FIELD = "13" [Inherited From DateFormat]
  Useful constant for WEEK_OF_MONTH field alignment.
publicfinalstatic int WEEK_OF_YEAR_FIELD = "12" [Inherited From DateFormat]
  Useful constant for WEEK_OF_YEAR field alignment.
publicfinalstatic int YEAR_FIELD = "1" [Inherited From DateFormat]
  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