The family of data types representing time and date intervals. The resulting types of the INTERVAL operator. Structure:Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
- Time interval as an unsigned integer value.
- Type of an interval.
NANOSECONDMICROSECONDMILLISECONDSECONDMINUTEHOURDAYWEEKMONTHQUARTERYEAR
DAY interval corresponds to the IntervalDay data type:
Usage Remarks
You can useInterval-type values in arithmetical operations with Date and DateTime-type values. For example, you can add 4 days to the current time:
Mixed-type Intervals
Intervals of mixed type, e.g. multiple hours and multiple minutes, can be created usingINTERVAL 'value' <from_kind> TO <to_kind> syntax.
The result is a tuple of two or more intervals.
Supported combinations:
| Syntax | String format | Example |
|---|---|---|
YEAR TO MONTH | Y-M | INTERVAL '2-6' YEAR TO MONTH |
DAY TO HOUR | D H | INTERVAL '5 12' DAY TO HOUR |
DAY TO MINUTE | D H:M | INTERVAL '5 12:30' DAY TO MINUTE |
DAY TO SECOND | D H:M:S | INTERVAL '5 12:30:45' DAY TO SECOND |
HOUR TO MINUTE | H:M | INTERVAL '1:30' HOUR TO MINUTE |
HOUR TO SECOND | H:M:S | INTERVAL '1:30:45' HOUR TO SECOND |
MINUTE TO SECOND | M:S | INTERVAL '5:30' MINUTE TO SECOND |
MONTH 0-11, HOUR 0-23, MINUTE 0-59, SECOND 0-59.
+ or - sign applies to all components:
See Also
- INTERVAL operator
- toInterval type conversion functions