YEAR(date)
SELECT YEAR(‘70-01-16') SELECT YEAR(‘2070-01-16') SELECT YEAR(‘69-01-16 00:00:00')
-> 1970 (表示返回date的4位数年份) -> 2070 -> 1969
It should be noted that if the year has only two digits, the automatic completion mechanism is based on the default time of 1970.01.01, > ;= Completion of 70 19, < Completion of 70 20
The above is the detailed content of How to use YEAR function in MySQL. For more information, please follow other related articles on the PHP Chinese website!