Use datetime, smalldatetime, date, and time to store absolute date and time information. Use timestamp to store binary-type information.
Adaptive Server has various ways to identify date and time. In versions earlier than 12.5.1, only datetime and smalldatetime were available. As of version 12.5.1, date and time are these separate datatypes:
date
time
smalldatetime
datetime
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 perform 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 uppercase or lowercase.
When entering date and time information, always enclose the time or date in single or double quotes.
Copyright © 2005. Sybase Inc. All rights reserved. |