PARSE_DURATION
All functions > DATE AND TIME > PARSE_DURATION
Returns an interval from the given duration string.
Signatures
Returns: An INTERVAL value representing the duration
PARSE_DURATION(duration: VARCHAR) → INTERVAL sql
| Parameter | Type | Required | Description |
|---|---|---|---|
duration | VARCHAR | Yes | A duration string to parse (e.g., '1 day', '2 hours') |
Notes
- Parses duration strings into INTERVAL values
- Supports formats like '1 day', '2 hours 30 minutes', '3 months'
- Useful for creating intervals from string representations
- Common units: seconds, minutes, hours, days, weeks, months, years
- Can combine multiple units in a single string
Examples
FeatureQL
SELECT
f1 := PARSE_DURATION('1 day'), -- Parse 1 day interval
f2 := PARSE_DURATION('2 hours 30 minutes'), -- Parse combined interval
f3 := PARSE_DURATION('3 months') -- Parse 3 months interval
;Result
| f1 VARCHAR | f2 VARCHAR | f3 VARCHAR |
|---|---|---|
| 1 days | 2 hours 30 mins | 3 mons |
On this page