Source
https://dev.mysql.com/doc/refman/8.0/en/datetime.html
Mysql 官方文档解释
The DATE
, DATETIME
, and TIMESTAMP
types are related.
DATE”、”DATETIME “和 “TIMESTAMP “类型是相关的。
This section describes their characteristics, how they are similar, and how they differ. MySQL recognizes DATE
, DATETIME
, and TIMESTAMP
values in several formats, described in Section 9.1.3, “Date and Time Literals”.
本节将介绍它们的特点、相似之处和不同之处。MySQL以几种格式识别DATE
、DATETIME
和TIMESTAMP
值,在第9.1.3节,”日期和时间字面”中描述。
For the DATE
and DATETIME
range descriptions, “supported” means that although earlier values might work, there is no guarantee.
对于 DATE
和 DATETIME
范围描述,”支持 “表示虽然早期值可能有效,但不能保证。
The DATE
type is used for values with a date part but no time part. MySQL retrieves and displays DATE
values in '_`YYYY-MM-DD`_'
format. The supported range is '1000-01-01'
to '9999-12-31'
.
Date
“类型用于包含日期部分但不包含时间部分的值。MySQL 以 '_`YYY-MM-DD`_'
格式检索和显示 DATE
值。支持的范围是1000-01-01
至 9999-12-31
。
The DATETIME
type is used for values that contain both date and time parts.