---
title: "A\u00D1O"
description: "La funci\u00F3n SQL YEAR extrae el a\u00F1o de una fecha/hora."
language: es
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/es/docs/invantive-universalsql/grammar/sql-functions/year
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/year
updated: 2026-12-04T14:56:57Z
license: https://documentation.invantive.eu/es/
---

## Sintaxis
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> YEAR[YEAR]:::quoted
    YEAR --> End((END))
```

## Propósito
La función SQL `YEAR` extrae el año de una fecha y hora.

See also [[DAY]], [[HOUR]], [[MICROSECOND]], [[MILLISECOND]], [[MINUTE]], [[MONTH]], and [[SECOND]].

Parámetros:
- Datos de entrada (`datetime`): la fecha y hora de las que se deben extraer los años.

Devuelve: el año como un `int32`.

## Ejemplos
El siguiente ejemplo extrae los años de la fecha y hora actuales del sistema en UTC:
```sql
select year(sysdateutc)

-------------------
2026
```
En el siguiente ejemplo se extraen los años de enero 1, 2026:
```sql
select year(to_date('20260101', 'YYYYMMDD'))

-------------------
2026
```

