The difference between date and datetime

Time format in SQL Server

The date type is a new data type introduced in SQL Server 2008. It only contains the date without the decimal part. The date range that can be represented is from January 1, 0001 to December 31, 9999. It requires 3 bytes of storage space.

datetime contains the date and time, and the range that can be expressed is from 00:00:00 on January 1, 1753 to 23:59:59:997 on December 31, 9999. The precision is 3.33 milliseconds, which occupies 8 bytes. The default time is 1900- 01-01 00:00:00

Add to sort out the date type in mySql

DATE()

date. Format: YYYY-MM-DD

Note: The supported range is from '1000-01-01' to '9999-12-31

DATETIME()

*A combination of date and time. Format: YYYY-MM-DD HH:MM:SS

Note: The supported range is from '1000-01-01 00:00:00' to '9999-12-31 23:59:59'

TIMESTAMP()

Timestamp. The TIMESTAMP value is stored using the description of the Unix epoch ('1970-01-01 00:00:00' UTC) so far. Format: YYYY-MM-DD HH:MM:SS

Note: The supported range is from '1970-01-01 00:00:01' UTC to '2038-01-09 03:14:07' UTC

Let me add the date type of oracle

Date type The format of date type storage data is year, month, day, hour, minute and second, which can be accurate to the second

The format of timestamp type storage data is year, month, day, hour, minute and second, which can be accurate to nanoseconds (9 digits)

Date type data can be displayed up to year, month, day, or year, month, day, hour, minute, and second, depending on the accuracy of the stored data

There is no datetime type in oracle

Introduction to Mysql data types and other Sql data types in SQL Server

Guess you like

Origin blog.csdn.net/qq_41661800/article/details/105559839
Recommended