Check out example codes for "SQL server datetime". It will help you in understanding the concepts better.

Code Example 1

Pressupondo uma tabela utilizador u.

year(u.DataInicio) --> Retorna o ano
month() --> Retorna o mês
day() --> dia

Exemplo:
u.Ativo = 1 AND year(u.DataInicio)<= 2018

Code Example 2

SELECT DATE_FORMAT("2017-06-15", "%Y");

Learn ReactJs, React Native from akashmittal.com