Date and Time

Source: Internet
Author: User

SQL Server 2005

Datetime and smalldatetime date types are used to represent the date and time of a day.

Datetime ranges from January 1-9, 1753 to December 31, 999, with an accuracy of 3.33 milliseconds.

Smalldatetime ranges from January 1, to January 1, with an accuracy of 1 minute.

Note:

1. SQL server uses two 4-byte Integers to represent datetime.

The first 4 bytes saves the number of days before or after the benchmark date. The reference date is, which is the reference time of the system.

The second 4-byte stores the time after midnight, with an accuracy of 1/300.

Values of the datetime type are rounded to. 000,. 003,. 007.

(9, 0, 1 then 0) (2, 3, 4 then 3) (5, 6, 7, 8 then 7)

2. the date and time represented by smalldatetime are not precise with datetime. SQL Server uses two 2-byte integers.

The first 2 bytes is the number of days before or after the benchmark date.

The second 2-byte stores the minutes after midnight.

Smalldatetime type value

Listen 29.99 move down to the nearest minute

Round 29.98 rounded up to the last minute

 

Date and Time

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: info-contact@alibabacloud.com 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.