how to get year from date field?

by Ramya 2008-12-09 09:51:42

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';

Tagged in:

957
like
1
dislike
0
mail
flag

You must LOGIN to add comments