Home > Database > Mysql Tutorial > What are the MySQL date and time data types?

What are the MySQL date and time data types?

WBOY
Release: 2023-06-03 18:22:29
forward
2655 people have browsed it

MySQL date and time data type

1. datatime and date

Datetime format: year-month-day hour: minute: second Support range 1000-01-01 00:00:00 To 9999-12-31 23:59:59

 2. timestamp timestamp

Datetime and timestamp types behave the same, their difference is:

datetime From 1-9999, and timestamp from 1970-2038 (the reason is that timestamp occupies 4 bytes, the same as the integer range, the number of seconds after 11:14:07 on January 19, 2038 exceeds 4 bytes Section length)

 3. year

 Can only represent years between 1901-2155, because it only occupies 1 byte and can only represent 255 numbers.

 4. time

 Can represent time or time interval, range -838:59:59-838:59:59

The above is the detailed content of What are the MySQL date and time data types?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template