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.
datetime columns hold dates between January 1, 1753 and December 31, 9999. datetime values are accurate to 1/300 second on platforms that support this level of granularity. Storage size is 8 bytes: 4 bytes for the number of days since the base date of January 1, 1900 and 4 bytes for the time of day.
smalldatetime columns hold dates from January 1, 1900 to June 6, 2079, with accuracy to the minute. Its storage size is 4 bytes: 2 bytes for the number of days after January 1, 1900, and 2 bytes for the number of minutes after midnight.
date columns hold dates from January 1, 0001 to December 31, 9999. Storage size is 4 bytes.
time is between 00:00:00:000 and 23:59:59:999. You can use either military time or 12AM for noon and 12PM for midnight. A time value must contain either a colon or the AM or PM signifier. AM or PM may be in either upper or lower case.
When entering date and time information always enclose the time or date in single or double quotes.