YEAR Function - SQL Server to MySQL Migration

In SQL Server and MySQL, the YEAR function extracts the year number from the datetime.

SQL Server:

  -- Get the year
  SELECT YEAR('2024-10-24');
  # 2024

MySQL:

  -- Get the year
  SELECT YEAR('2024-10-24');
  # 2024

For more information, see SQL Server to MySQL Migration.