public abstract class java.text.DateFormat extends java.text.Format
since: ???
direct subclasses: java.text.SimpleDateFormat
see also: java.text.Format, java.text.NumberFormat, java.text.SimpleDateFormat, java.util.Calendar, java.util.GregorianCalendar, java.util.TimeZone
methods: clone(), equals(Object obj), format(Date date), format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition), format(Object obj, StringBuffer toAppendTo, FieldPosition fieldPosition), getAvailableLocales(), getCalendar(), getDateInstance(), getDateInstance(int style), getDateInstance(int style, Locale aLocale), getDateTimeInstance(), getDateTimeInstance(int dateStyle, int timeStyle), getDateTimeInstance(int dateStyle, int timeStyle, Locale aLocale), getInstance(), getNumberFormat(), getTimeInstance(), getTimeInstance(int style), getTimeInstance(int style, Locale aLocale), getTimeZone(), hashCode(), isLenient(), parse(String text), parse(String text, ParsePosition pos), parseObject(String source, ParsePosition pos), setCalendar(Calendar newCalendar), setLenient(boolean lenient), setNumberFormat(NumberFormat newNumberFormat), setTimeZone(TimeZone zone)

DateFormat is an abstract class for date/time formatting subclasses which formats and parses dates or time in a
language-independent manner. The date/time formatting subclass, such as SimpleDateFormat, allows for formatting (i.e., date ->
text), parsing (text -> date), and normalization. The date is represented as a Date object or as the milliseconds since January 1,
1970, 00:00:00 GMT.

DateFormat provides many class methods for obtaining default date/time formatters based on the default or a given loacle and a
number of formatting styles. The formatting styles include FULL, LONG, MEDIUM, and SHORT. More detail and examples of
using these styles are provided in the method descriptions.

DateFormat helps you to format and parse dates for any locale. Your code can be completely independent of the locale
conventions for months, days of the week, or even the calendar format: lunar vs. solar.

To format a date for the current Locale, use one of the static factory methods:

myString = DateFormat.getDateInstance().format(myDate);

If you are formatting multiple numbers, it is more efficient to get the format and use it multiple times so that the system doesn't have
to fetch the information about the local language and country conventions multiple times.

DateFormat df = DateFormat.getDateInstance();
for (int i = 0; i < a.length; ++i) {
output.println(df.format(myDate[i]) + "; ");

To format a number for a different Locale, specify it in the call to getDateInstance().

DateFormat df = DateFormat.getDateInstance(Locale.FRANCE);

You can use a DateFormat to parse also.

myDate = df.parse(myString);

Use getDate to get the normal date format for that country. There are other static factory methods available. Use getTime to get
the time format for that country. Use getDateTime to get a date and time format. You can pass in different options to these factory
methods to control the length of the result; from SHORT to MEDIUM to LONG to FULL. The exact result depends on the
locale, but generally:

SHORT is completely numeric, such as 12.13.52 or 3:30pm
MEDIUM is longer, such as Jan 12, 1952
LONG is longer, such as January 12, 1952 or 3:30:32pm
FULL is pretty completely specified, such as Tuesday, April 12, 1952 AD or 3:30:42pm PST.

You can also set the time zone on the format if you wish. If you want even more control over the format or parsing, (or want to
give your users more control), you can try casting the DateFormat you get from the factory methods to a SimpleDateFormat. This
will work for the majority of countries; just remember to put it in a try block in case you encounter an unusual one.

You can also use forms of the parse and format methods with ParsePosition and FieldPosition to allow you to

progressively parse through pieces of a string.
align any particular field, or find out where it is for selection on the screen.

source: Sun's Java documentation for JDK 1.3
Sun Microsystems:   |   Sun's Java:   |   JDK 1.3 API docs: