INTERVAL_TO_MS()

All functions > DATE AND TIME > INTERVAL_TO_MS()

Returns the truncated number of milliseconds in the given interval.

Signatures

Returns: The total number of milliseconds as BIGINT

INTERVAL_TO_MS(interval: INTERVAL) → BIGINT
sql
ParameterTypeRequiredDescription
intervalINTERVALYesAn INTERVAL value to convert

Notes

  • Converts interval duration to milliseconds
  • Returns truncated millisecond count
  • Useful for duration calculations and comparisons
  • Result is always a whole number (BIGINT)
  • Sub-millisecond precision is truncated, not rounded

Examples

FeatureQL
SELECT
    f1 := INTERVAL_TO_MS(INTERVAL_PARSE('1 second')), -- Convert 1 second to milliseconds
    f2 := INTERVAL_TO_MS(INTERVAL_PARSE('5 minutes')) -- Convert 5 minutes to milliseconds
;
Result
f1 BIGINTf2 BIGINT
1000300000

Last update at: 2026/05/26 17:22:09