background image
<< Setting the NLS_TERRITORY parameter | Using the NLS-DATE-LANGUAGE Parameter >>
<< Setting the NLS_TERRITORY parameter | Using the NLS-DATE-LANGUAGE Parameter >>

Setting Dates and Time Parameters

Establishing a Globalization Support Environment
6-12 Oracle Database 2 Day Developer's Guide
ALTER SESSION SET NLS_TERRITORY=AMERICA;
Setting Date and Time Parameters
You can control the display of the date and time, allowing different conventions for
displaying the hour, day, month, and year based on the local formats. For example, in
the United Kingdom, the date is displayed using the
DD/MM/YYYY
format, while
China commonly uses the
YYYY-MM-DD
format.
Using Date Formats
You can use several different date formats, as shown in the following table.
To use the NLS2008FORMAT parameter:
The
NLS2008FORMAT
parameter defines the default date format to use with the
TO_CHAR
and
TO_DATE
functions. The
NLS_TERRITORY
parameter determines the
default value of the
NLS2008FORMAT
parameter. The value of
NLS2008FORMAT
can be any valid date format model. For example:
NLS2008FORMAT = "MM/DD/YYYY"
To add string literals to the date format, enclose the string literal with double
quotation marks. Note that when double quotation marks are included in the date
format, the entire value must be enclosed by single quotation marks. For example:
NLS2008FORMAT = '"Date: "MM/DD/YYYY'
The Oracle default date format may not always correspond to the cultural-specific
convention used in a given territory. You can use the short date and long date format
in SQL, using the
'DS'
and
'DL'
format models, respectively, to obtain dates in
localized formats. The following example shows the use of the short and long date
formats.
See Also:
Oracle Database Reference for more information on the
NLS_
TERRITORY
parameter
Using the NLS_LANGUAGE Parameter
on page 6-9
Oracle Database Globalization Support Guide for locale information,
including supported languages and territories
See Also:
Oracle Database Globalization Support Guide for information about
date/time data types and time zone support
Oracle Database SQL Language Reference for information about date
and time formats
Country
Description
Example
Estonia
dd.mm.yyyy
28.02.2005
Germany
dd.mm.rr
28.02.05
China
yyyy-mm-dd
2005-02-28
UK
dd/mm/yyyy
28/02/2005
U.S.
mm/dd/yyyy
02/28/2005