DATE_SLICE

Converts a given time to the beginning or end of a time interval based on the specified period.

Analyze Syntax

func.date_slice(<datetime>, INTERVAL <n> <unit>[, <boundary>])

Analyze Examples

func.date_slice('2024-06-15 14:35:00', text('INTERVAL 1 HOUR'))

┌───────────────────────┐
 '2024-06-15 14:00:00'  
└───────────────────────┘

SQL Syntax

DATE_SLICE(<datetime>, INTERVAL <n> <unit>[, <boundary>])

SQL Examples

SELECT DATE_SLICE('2024-06-15 14:35:00', INTERVAL 1 HOUR);

┌─────────────────────┐
 2024-06-15 14:00:00  
└─────────────────────┘