Dates consist of a month, day, and year and can be entered in a variety of formats for date, datetime, bigdatetime, bigtime and smalldatetime.
When entering dates as unseparated strings, use the appropriate format for that string length. Use leading zeros for single-digit years, months, and days. Dates entered in the wrong format may be misinterpreted or result in errors.
When entering dates with separators, use the set dateformat option to determine the expected order of date parts. If the first date part in a separated string is four digits, SAP ASE interprets the string as yyyy-mm-dd format.
Numbers less than 50 are interpreted as 20yy. For example, 01 is 2001, 32 is 2032, and 49 is 2049.
Numbers equal to or greater than 50 are interpreted as 19yy. For example, 50 is 1950, 74 is 1974, and 99 is 1999.
You can specify the month as either a number or a name. Month names and their abbreviations are language-specific and can be entered in uppercase, lowercase, or mixed case.
If you omit the date portion of a datetime or smalldatetime value, SAP ASE uses the default date of January 1, 1900. If you omit the date portion of a bigdatetime a default value of January 1, 0001 is added.
This table describes the acceptable formats for entering the date portion of a datetime or smalldatetime value:
Date Format |
Interpretation |
Sample Entries |
Meaning |
---|---|---|---|
4-digit string with no separators |
Interpreted as yyyy. Date defaults to Jan 1 of the specified year. |
“1947” |
Jan 1 1947 |
6-digit string with no separators |
Interpreted as yymmdd. For yy < 50, year is 20yy. For yy >= 50, year is 19yy. |
“450128” “520128” |
Jan 28 2045 Jan 28 1952 |
8-digit string with no separators |
Interpreted as yyyymmdd. |
“20150415” |
Apr 15 2015 |
String consisting of 2-digit month, day, and year separated by slashes, hyphens, or periods, or a combination of the above |
The dateformat and language set options determine the expected order of date parts. For us_english, the default order is mdy. For yy < 50, year is interpreted as 20yy. For yy >= 50, year is interpreted as 19yy. |
“12/15/94” “12.15.94” “12-15-94” “12.15/94” |
All of these entries are interpreted as Dec 15 1994 when the dateformat option is set to mdy. |
String consisting of 2-digit month, 2-digit day, and 4-digit year separated by slashes, hyphens, or periods, or a combination of the above |
The dateformat and language set options determine the expected order of date parts. For us_english, the default order is mdy. |
“04/15.1994” |
Interpreted as Apr 15 1994 when the dateformat option is set to mdy. |
Month is entered in character form (either full month name or its standard abbreviation), followed by an optional comma |
If 4-digit year is entered, date parts can be entered in any order. |
“April 15, 1994” “1994 15 apr” “1994 April 15” “15 APR 1994” |
All of these entries are interpreted as Apr 15 1994. |
If day is omitted, all 4 digits of year must be specified. Day defaults to the first day of the month. |
“apr 1994” |
Apr 1 1994 |
|
If year is only 2 digits (yy), it is expected to appear after the day. For yy < 50, year is interpreted as 20yy. For yy >= 50, year is interpreted as 19yy. |
“mar 16 17” “apr 15 94” |
Mar 16 2017 Apr 15 1994 |
|
The empty string “” |
Date defaults to Jan 1 1900. |
“” |
Jan 1 1900 |