Date and time datatypes

Use the datetime and smalldatetime datatypes to store date and time information from January 1, 1753 through December 31, 9999. Use date for dates from January 1, 0001 to December 31, 9999 or time for 12:00:00 a.m. to 11:59:59:999. Dates outside this range must be entered, stored, and manipulated as char or varchar values.

Enclose date and time information in single or double quotes. You can enter it in either uppercase or lowercase letters and include spaces between data parts. Adaptive Server recognizes a wide variety of data entry formats, which are described in Chapter 7, “Adding, Changing, Transferring, and Deleting Data.” However, Adaptive Server rejects values such as 0 or 00/00/00, which are not recognized as dates.

The default display format for dates is “Apr 15 1987 10:23p.m.”. You can use the convert function for other formats. You can also perform some arithmetic calculations on datetime values with the built-in date functions, although Adaptive Server may round or truncate millisecond values, unless you use the time datatype.

For bigdatetime and bigtime, the value that appears reflects microsecond precision. bigdatetime and bigtime have default display formats that accomodate this increased precision.