Java Reference
In-Depth Information
Date Format
Description
SHORT
A completely numeric representation for a date or a time, such as 2/2/97 or
4:15 am.
MEDIUM
A longer representation than
SHORT
, such as 5-Dec-97.
LONG
A longer representation than
MEDIUM
, such as December 5, 1997.
FULL
A comprehensive representation of the date or the time such as Friday,
December 5, 1997 AD or 4:45:52 PST (Pacific Standard Time).
A
Locale
object identifies information that is specific to a country, a region, or a language. You can
define a
Locale
object for a specific country, for a specific language, for a country and a language, or
for a country and a language and a variant, the latter being a vendor or browser specific code such as
WIN
or
MAC
. When you are creating a
Locale
object you use ISO codes to specify the language and/or
the country. The language codes are defined by ISO-639. Countries are specified by the country codes
in the standard ISO-3166. You can find the country codes on the Internet at:
http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
or at:
http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/en_listp1.html
You can find the language codes at:
http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt
or at:
http://lcweb.loc.gov/standards/iso639-2/langhome.html
For some countries, the easiest way to specify the locale, if you don't have the ISO codes on the tip of
your tongue, is to use the
Locale
objects defined within the
Locale
class. In Java 2 these are:
US
CANADA
CANADA_FRENCH
PRC
UK
GERMANY
FRANCE
ITALY
JAPAN
KOREA
CHINA
TAIWAN
Because the
DateFormat
class is
abstract
, you can't create objects of the class directly, but you can
obtain
DateFormat
objects by using any of the following
static
methods, each of which returns a
value of type
DateFormat
: