Date and timestamp functions

Operations on TIMESTAMP columns.

DAYOFMONTH

Supported datatypes: TIMESTAMP

Extract the day of the month from a TIMESTAMP column.

See also

EXTRACT

Example

SELECT DAYOFMONTH(<col_1>)
FROM <table_name>

DAYOFWEEK

Supported datatypes: TIMESTAMP

Extract the day of the week from a TIMESTAMP column.

Note

Returned values range \([1,7]\)

See also

EXTRACT

Example

SELECT DAYOFMONTH(<col_1>)
FROM <table_name>

HOUR

Supported datatypes: TIMESTAMP

Extract the hour from a TIMESTAMP column.

See also

EXTRACT

Example

SELECT HOUR(<col_1>)
FROM <table_name>

MINUTE

Supported datatypes: TIMESTAMP

Extract the minute from a TIMESTAMP column.

See also

EXTRACT

Example

SELECT MINUTE(<col_1>)
FROM <table_name>

MONTH

Supported datatypes: TIMESTAMP

Extract the month from a TIMESTAMP column.

See also

EXTRACT

Example

SELECT MONTH(<col_1>)
FROM <table_name>

SECOND

Supported datatypes: TIMESTAMP

Extract the second from a TIMESTAMP column.

See also

EXTRACT

Example

SELECT SECOND(<col_1>)
FROM <table_name>

YEAR

Supported datatypes: TIMESTAMP

Extract the year from a TIMESTAMP column.

See also

EXTRACT

Example

SELECT YEAR(<col_1>)
FROM <table_name>

EXTRACT

Supported datatypes: TIMESTAMP

Extract the value from a TIMESTAMP column specified by the qualifier.

This functionality is compatible with the other TIMESTAMP functions.

Functionality mapping

Datetime part

SQL function

EXTRACT qualifier

Year value

YEAR

YEAR

Month value

MONTH

MONTH

Day of a month

DAYOFMONTH

DAY

Day of the week

DAYOFWEEK

DAYOFWEEK

Hour of the day

HOUR

HOUR

Minute of the hour

MINUTE

MINUTE

Second of the minute

SECOND

SECOND

Examples

Extract year value from TIMESTAMP column.

SELECT EXTRACT(YEAR FROM <col_1>)
FROM <table_name>

Extract second value from TIMESTAMP column.

SELECT EXTRACT(SECOND FROM <col_1>)
FROM <table_name>