how to get year from date field? - Mysql Views : 957
Tagged in : Mysql
1 0
Send mail
Get year from date field:

Sometimes we need to get only year from the date("2006-12-05").
In that case use YEAR( ) as,

mysql> SELECT YEAR(datefield) FROM tablename;


For example,

mysql> SELECT * from table_name where year(datefield)='2006';
By Ramya, On - 2008-12-09



    Login to add Comments .