Date and time data types
280
For combinations of dates and times, any unambiguous date and any
unambiguous time yield an unambiguous date-time value. Also, the form
YYYY-MM-DD HH.MM.SS.SSS
is an unambiguous date-time value. Periods can be used in the time only in
combination with a date.
In other contexts, a more flexible date format can be used. Adaptive Server
Anywhere can interpret a wide range of strings as dates. The interpretation
depends on the setting of the database option DATE_ORDER. The
DATE_ORDER database option can have the value MDY, YMD, or DMY
(see "SET OPTION statement" on page 612). For example, the following
statement sets the DATE_ORDER option to DMY:
SET OPTION DATE_ORDER = ’DMY’ ;
The default DATE_ORDER setting is ’YMD’. The ODBC driver sets the
DATE_ORDER option to ’YMD’ whenever a connection is made. The value
can still be changed using the SET TEMPORARY OPTION statement.
The database option DATE_ORDER determines whether the string 10/11/12
is interpreted by the database as Oct 11 1912, Nov 12 1910, or Nov 10 1912.
The year, month, and day of a date string should be separated by some
character (for example /, -, or space) and appear in the order specified by the
DATE_ORDER option. The year can be supplied as either 2 or 4 digits, with
2 digit years defaulting to the 20th century. The month can be the name or
number of the month. The hours and minutes are separated by a colon, but
can appear anywhere in the string.
♦ We recommend that you always specify the year using the four-digit
format.
$ For more information about Y2K compliance issues, see "Year
2000 compliance" on page 297.
♦ With an appropriate setting of DATE_ORDER, the following strings are
all valid dates:
92-05-23 21:35
92/5/23
1992/05/23
May 23 1992
23-May-1992
Tuesday May 23, 1992 10:00pm
♦ If a string contains only a partial date specification, default values are
used to fill out the date. The following defaults are used:
♦
year This year
Notes