Analyze smalldatetime and datetime in SQL

Source: Internet
Author: User
For more information about how to analyze smalldatetime and datetime in SQL, see.

For more information about how to analyze smalldatetime and datetime in SQL, see.

1: Date range

The valid time range of smalldatetime is ~ 2079/6/6
The valid time range of datetime is 1753/1/1 ~ 9999/12/31

2: Accuracy

Smalldatetime is accurate to the minute, while datetime is accurate to 3-bit milliseconds.

3: storage space

Smalldatetime occupies four bytes, and the first two bytes store the number of days after base date (January 1, January 1, 1900. The last two bytes are stored in minutes after midnight.

Datetime occupies 8 bytes. The first 4 bytes store the number of days before or after base date (January 1, 1900), and the last 4 bytes store the number of milliseconds after midnight.

Example Adjusted example
01/01/98 23:59:59. 999 00:00:00. 000
01/01/98 23:59:59. 995,
01/01/98 23:59:59. 996,
01/01/98 23:59:59. 997, or
01/01/98 23:59:59. 998
23:59:59. 997
01/01/98 23:59:59. 992,
01/01/98 23:59:59. 993,
01/01/98 23:59:59. 994
23:59:59. 993
01/01/98 23:59:59. 990 or
01/01/98 23:59:59. 991
23:59:59. 990

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.