D/MySQL

MySQL YEAR()

yeon.Biju 2020. 4. 5. 13:35

MySQL 날짜함수, 시간함수

 

YEAR()

   -

 

YEAR(date)

의 형태

 

Returns the year for date, in the range 1000 to 9999, or 0 for the "zero" date.

 

mysql> SELECT YEAR(NOW());
+-------------+
| YEAR(NOW()) |
+-------------+
|        2020 |
+-------------+
1 row in set (0.00 sec)

 

mysql> SELECT YEAR('2020-04-01');
+--------------------+
| YEAR('2020-04-01') |
+--------------------+
|               2020 |
+--------------------+
1 row in set (0.00 sec)