PARSE_DURATION

All functions > DATE_AND_TIME > PARSE_DURATION

Returns an interval from the given duration string.

Syntax

PARSE_DURATION(duration)
sql

Arguments

ParameterTypeRequiredDescription
durationVARCHARYesA duration string to parse (e.g., '1 day', '2 hours')

Returns

An INTERVAL value representing the duration

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

Last update at: 2025/10/13 10:23:46