sql string to date check year code example Example: sql convert datetime to year select YEAR(getdate()) /* 2020 */