Aller au contenu

Convertit une date ou une date avec heure (horodatage/datetime) en nombre UInt8 contenant le numéro du mois (1-12).

func.to_month(<expr>)
func.now(), func.to_month(func.now()), func.month(func.now())
┌─────────────────────────────────────────────────────────────────────────────────┐
│ func.now() │ func.to_month(func.now()) │ func.month(func.now()) │
├────────────────────────────┼───────────────────────────┼────────────────────────┤
│ 2024-03-14 23:34:02.161291 │ 3 │ 3 │
└─────────────────────────────────────────────────────────────────────────────────┘
TO_MONTH(<expr>)
Arguments Description
<expr> date/horodatage

TINYINT

SELECT NOW(), TO_MONTH(NOW()), MONTH(NOW());
┌─────────────────────────────────────────────────────────────┐
│ now() │ to_month(now()) │ month(now()) │
├────────────────────────────┼─────────────────┼──────────────┤
│ 2024-03-14 23:34:02.161291 │ 3 │ 3 │
└─────────────────────────────────────────────────────────────┘