Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.text

Class SimpleDateFormat

java.lang.Object
|
+--java.text.Format
   |
   +--java.text.DateFormat
      |
      +--java.text.SimpleDateFormat


public class SimpleDateFormat

extends DateFormat

SimpleDateFormat provides convenient methods for parsing and formatting dates using Gregorian calendars (see java.util.GregorianCalendar).

Constructor Summary

SimpleDateFormat()

Constructs a SimpleDateFormat using the default pattern for the default locale.
SimpleDateFormat(java.lang.String pattern)

Creates a date formatter using the specified pattern, with the default DateFormatSymbols for the default locale.
SimpleDateFormat(java.lang.String pattern, java.util.Locale locale)

Creates a date formatter using the specified pattern, with the default DateFormatSymbols for the given locale.
SimpleDateFormat(java.lang.String pattern, java.text.DateFormatSymbols formatData)

Creates a date formatter using the specified pattern.

Method Summary

voidapplyLocalizedPattern(java.lang.String pattern)

This method sets the formatting pattern that should be used by this object.
voidapplyPattern(java.lang.String pattern)

This method sets the formatting pattern that should be used by this object.
booleanequals(java.lang.Object o)

This methods tests whether the specified object is equal to this object.
java.lang.StringBufferformat(java.util.Date date, java.lang.StringBuffer buffer, java.text.FieldPosition pos)

Formats the date input according to the format string in use, appending to the specified StringBuffer.
java.util.Dateget2DigitYearStart()

Returns the start of the century used for two digit years.
java.text.DateFormatSymbolsgetDateFormatSymbols()

This method returns the format symbol information used for parsing and formatting dates.
java.util.Dateparse(java.lang.String dateStr, java.text.ParsePosition pos)

This method parses the specified string into a date.
voidset2DigitYearStart(java.util.Date date)

Sets the start of the century used for two digit years.
voidsetDateFormatSymbols(java.text.DateFormatSymbols formatData)

This method sets the format symbols information used for parsing and formatting dates.
java.lang.StringtoLocalizedPattern()

This method returns a string with the formatting pattern being used by this object.
java.lang.StringtoPattern()

This method returns a string with the formatting pattern being used by this object.
java.lang.StringtoString()

Constructor Details

SimpleDateFormat

public SimpleDateFormat()

Constructs a SimpleDateFormat using the default pattern for the default locale.


SimpleDateFormat

public SimpleDateFormat(java.lang.String pattern)

Creates a date formatter using the specified pattern, with the default DateFormatSymbols for the default locale.

Parameters:


SimpleDateFormat

public SimpleDateFormat(java.lang.String pattern, java.text.DateFormatSymbols formatData)

Creates a date formatter using the specified pattern. The specified DateFormatSymbols will be used when formatting.

Parameters:


SimpleDateFormat

public SimpleDateFormat(java.lang.String pattern, java.util.Locale locale)

Creates a date formatter using the specified pattern, with the default DateFormatSymbols for the given locale.

Parameters:


Method Details

applyLocalizedPattern

public void applyLocalizedPattern(java.lang.String pattern)

This method sets the formatting pattern that should be used by this object. This string is localized.

Parameters:


applyPattern

public void applyPattern(java.lang.String pattern)

This method sets the formatting pattern that should be used by this object. This string is not localized.

Parameters:


equals

public boolean equals(java.lang.Object o)

This methods tests whether the specified object is equal to this object. This will be true if and only if the specified object:

Parameters:

Returns:


format

public StringBuffer format(java.util.Date date, java.lang.StringBuffer buffer, java.text.FieldPosition pos)

Formats the date input according to the format string in use, appending to the specified StringBuffer. The input StringBuffer is returned as output for convenience.

Parameters:


get2DigitYearStart

public Date get2DigitYearStart()

Returns the start of the century used for two digit years.

Returns:


getDateFormatSymbols

public DateFormatSymbols getDateFormatSymbols()

This method returns the format symbol information used for parsing and formatting dates.

Returns:


parse

public Date parse(java.lang.String dateStr, java.text.ParsePosition pos)

This method parses the specified string into a date.

Parameters:

Returns:


set2DigitYearStart

public void set2DigitYearStart(java.util.Date date)

Sets the start of the century used for two digit years.

Parameters:


setDateFormatSymbols

public void setDateFormatSymbols(java.text.DateFormatSymbols formatData)

This method sets the format symbols information used for parsing and formatting dates.

Parameters:


toLocalizedPattern

public String toLocalizedPattern()

This method returns a string with the formatting pattern being used by this object. This string is localized.

Returns:


toPattern

public String toPattern()

This method returns a string with the formatting pattern being used by this object. This string is unlocalized.

Returns:


toString

public String toString()