TO_YEAR (Lakehouse v1)
Convertit une date ou une date avec heure (timestamp/datetime) en nombre UInt16 contenant l’année (ap. J.-C.).
Syntaxe Analyze
Section intitulée « Syntaxe Analyze »func.to_year(<expr>)Exemples Analyze
Section intitulée « Exemples Analyze »func.now(), func.to_year(func.now()), func.year(func.now())
┌───────────────────────────────────────────────────────────────────────────────┐│ func.now() │ func.to_year(func.now()) │ func.year(func.now()) │├────────────────────────────┼──────────────────────────┼───────────────────────┤│ 2024-03-14 23:37:03.895166 │ 2024 │ 2024 │└───────────────────────────────────────────────────────────────────────────────┘Syntaxe SQL
Section intitulée « Syntaxe SQL »TO_YEAR(<expr>)Arguments
Section intitulée « Arguments »| Arguments | Description |
|---|---|
<expr> |
date/timestamp |
Type de retour
Section intitulée « Type de retour »SMALLINT
Exemples SQL
Section intitulée « Exemples SQL »SELECT NOW(), TO_YEAR(NOW()), YEAR(NOW());
┌───────────────────────────────────────────────────────────┐│ now() │ to_year(now()) │ year(now()) │├────────────────────────────┼────────────────┼─────────────┤│ 2024-03-14 23:37:03.895166 │ 2024 │ 2024 │└───────────────────────────────────────────────────────────┘