Home > Database > Mysql Tutorial > How to use YEAR function in MySQL

How to use YEAR function in MySQL

王林
Release: 2023-06-03 23:21:34
forward
1551 people have browsed it

YEAR(date)

SELECT YEAR(‘70-01-16') 
SELECT YEAR(‘2070-01-16') 
SELECT YEAR(‘69-01-16 00:00:00')
Copy after login
-> 1970 (表示返回date的4位数年份)
-> 2070 
-> 1969
Copy after login

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!

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