Jump to: navigation, search

Mysql YEAR

From w3cyberlearnings

Contents

MySQL YEAR Function

This function returns the year.

Syntax YEAR

  • expre: date or datetime expression
YEAR(expre);

Example 1

mysql> SELECT YEAR('2012-05-22');
+--------------------+
| YEAR('2012-05-22') |
+--------------------+
|               2012 |
+--------------------+
1 row in set (0.00 sec)

Example 2

mysql> SELECT YEAR('2012-05-22 2:2:40');
+---------------------------+
| YEAR('2012-05-22 2:2:40') |
+---------------------------+
|                      2012 |
+---------------------------+
1 row in set (0.00 sec)

Related Links



Navigation
Web
SQL
MISC
References