Aller au contenu

Arrondit une date avec heure (horodatage/datetime) au début de l’heure.

func.to_start_of_hour(<expr>)
func.to_start_of_hour('2023-11-12 09:38:18.165575')
┌────────────────────────────────────────────────────────────────┐
│ func.to_start_of_hour('2023-11-12 09:38:18.165575') │
│ Timestamp │
├────────────────────────────────────────────────────────────────┤
│ 2023-11-12 09:00:00 │
└────────────────────────────────────────────────────────────────┘
TO_START_OF_HOUR(<expr>)
Arguments Description
<expr> horodatage

TIMESTAMP, renvoie la date au format « YYYY-MM-DD hh:mm:ss.ffffff ».

SELECT
to_start_of_hour('2023-11-12 09:38:18.165575')
┌────────────────────────────────────────────────┐
│ to_start_of_hour('2023-11-12 09:38:18.165575') │
│ Timestamp │
├────────────────────────────────────────────────┤
│ 2023-11-12 09:00:00 │
└────────────────────────────────────────────────┘