MySQL: date type, mysql date type
1. datetime (year, month, day, hour, minute, second)
Format: 'yyy-MM-DD HH: MM: ss '.
Occupied: 8 bytes
Range: 1000-01-01 00:00:00 to 9999-12-31 23:59:59.
Tip: it can receive dates of any separator, mainly to determine whether the date is correct and whether it is within the correct range.
However, non-General delimiters are less readable and are not recommended:
Tip: when the year is expressed in two digits, it must be 70 ~ 99 represents 1979 ~ 1999, while 00 ~ 69 represents 2000 ~ 2069.
If only the year, month, and day are provided, and the time and second are not written, the default time and second part is 00:00:00.
Value 0: indicates that there is no rule currently.
2013-04-0 indicates the entire month of January 1, April.
2. date (year, month, and day)
3. timestamp (timestamp)
It is an integer, but it is similar to the datetime type.
Usage: 4 bytes
Range: 00:00:00 to 03:14:07 (affected by the integer size)
When the insertion time exceeds the preceding range, an error is returned and cannot be inserted correctly.
Tip: When retrieving a column, + 0 can retrieve the timestamp: