Date and time datatypes

Adaptive Server has various ways to identify date and time. Prior to version 12.5.1, only datetime and smalldatetime were available. As of version 12.5.1, date and time have been added as separate datatypes.

Datatype

Date range

Storage size

date

January 1, 0001 to December 31, 9999

4

time

12:00:00:000 AM to 11:59:59.999 PM

4

smalldatetime

January 1, 1900 to June 6, 2079

4

datetime

January 1, 1753 to December 31, 9999

8

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; 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:23PM”. You can use the convert function for other styles of date display. You can also do some arithmetic calculations on date and time values with the built-in date functions, though Adaptive Server may round or truncate millisecond values.

When entering date and time information always enclose the time or date in single or double quotes.