selecting year from a datetime field in SQL code example Example: sql convert datetime to year select YEAR(getdate()) /* 2020 */