Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 1.1 KB

File metadata and controls

38 lines (28 loc) · 1.1 KB
description
Extracts the minute number (from 0 to 59) for a given time or timestamp.

MINUTE

Syntax

EXTRACT(MINUTE FROM date_timestamp_expression string) → bigint

  • timestamp_expression: A TIME, TIMESTAMP, or DATE expression.

Examples

{% code title="MINUTE example using a timestamp." %}

SELECT EXTRACT(MINUTE FROM TIMESTAMP '2019-08-12 01:10:30.123456')
-- 10

{% endcode %}

{% code title="MINUTE example using a time." %}

SELECT EXTRACT(MINUTE FROM TIME '01:10:30.123456')
-- 10

{% endcode %}

{% code title="MINUTE example using the CAST function." %}

SELECT EXTRACT(MINUTE FROM CAST('2019-08-12 01:10:30' AS TIMESTAMP))
-- 10

{% endcode %}

Usage Notes

This function uses the EXTRACT function. When using the CAST function, timestamps containing milliseconds are not allowed.