SAP ASE recognizes three basic date formats. Each format must be enclosed in quotes and can be preceded or followed by a time specification.
Apr[il] [15][,] 1997 Apr[il] 15[,] [19]97 Apr[il] 1997 [15]
[15] Apr[il][,] 1997 15 Apr[il][,] [19]97 15 [19]97 apr[il] [15] 1997 apr[il]
1997 APR[IL] [15] 1997 [15] APR[IL]
Month can be a three-character abbreviation, or the full month name, as given in the specification for the current language.
Commas are optional.
Case is ignored.
If you specify only the last two digits of the year, values of less than 50 are interpreted as “20yy,” and values of 50 or more are interpreted as “19yy.”
Type the century only when the day is omitted or when you need a century other than the default.
If the day is missing, SAP ASE defaults to the first day of the month.
When you specify the month in alphabetic format, the dateformat setting is ignored (see the Reference Manual: Commands).
The month, day, and year must be specified.
The strings must be in the form:
<num> <sep> <num> <sep> <num> [ <time spec> ]
or:
[ <time spec> ] <num> <sep> <num> <sep> <num>
The interpretation of the values of the date parts depends on the dateformat setting. If the ordering does not match the setting, either the values are not interpreted as dates, because the values are out of range, or the values are misinterpreted. For example, “12/10/08” can be interpreted as one of six different dates, depending on the dateformat setting. See the Reference Manual: Commands.
[0]4/15/[19]97 [0]4-15-[19]97 [0]4.15.[19]97
15/[0]4/[19]97 (dmy) 1997/[0]4/15 (ymd) 1997/15/[0]4 (ydm) [0]4/[19]97/15 (myd) 15/[19]97/[0]4 (dym)
The dateformat is always ignored with this entry format.
If four digits are given, the string is interpreted as the year, and the month is set to January, the day to the first of the month. The century cannot be omitted.
Six- or eight-digit strings are always interpreted as ymd; the month and day must always be two digits. This format is recognized: [19]960415.
An empty string (“”) or missing date is interpreted as the base date, January 1, 1900. For example, a time value like “4:33” without a date is interpreted as “January 1, 1900, 4:33AM’’.
The set datefirst command specifies the day of the week (Sunday, Monday, and so on) when weekday or dw is used with datename, and a corresponding number when used with datepart. Changing the language with set language can also affect the format for dates, depending on the default first day of the week value for the language. For the default language of us_english, the default datefirst setting is Sunday=1, Monday=2, and so on; others produce Monday=1, Tuesday=2, and so on. Use set datefirst to change default behavior on a per-session basis. See the Reference Manual: Commands.