Skip to content
Blog

Interval functions

Interval functions are used to create and manipulate intervals.

FunctionDescriptionExampleResult
date_part(part, interval)returns the subfield of the datedate_part('year', INTERVAL('20 YEARS 367 DAYS'))20 (INT64)
to_years(integer)returns the year interval based on the yearto_years(3)3 years (INTERVAL)
to_months(integer)returns the month interval based on the monthto_months(5)5 months (INTERVAL)
to_days(integer)returns the day interval based on the daysto_days(2)2 days (INTERVAL)
to_hours(integer)returns the hour interval based on the hoursto_hours(10)10:00:00 (INTERVAL)
to_minutes(integer)returns the minutes interval based on the minutesto_minutes(30)00:30:00 (INTERVAL)
to_seconds(integer)returns the seconds interval based on the secondsto_seconds(22)00:00:22 (INTERVAL)
to_milliseconds(integer)returns the milliseconds interval based on the millisecondsto_milliseconds(27)00:00:00.027 (INTERVAL)
to_microseconds(integer)returns the microseconds interval based on the microsecondsto_microseconds(98)00:00:00.000098 (INTERVAL)