how to get only the year from a date in sql code example Example: sql get year from datetime field SELECT YEAR(DateTimeField) FROM MyTable