Date and timestamp functions¶
Operations on TIMESTAMP
columns.
DAYOFMONTH¶
Supported datatypes: TIMESTAMP
Extract the day of the month from a TIMESTAMP
column.
See also
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
Example¶
SELECT DAYOFMONTH(<col_1>)
FROM <table_name>
HOUR¶
Supported datatypes: TIMESTAMP
Extract the hour from a TIMESTAMP
column.
See also
Example¶
SELECT HOUR(<col_1>)
FROM <table_name>
MINUTE¶
Supported datatypes: TIMESTAMP
Extract the minute from a TIMESTAMP
column.
See also
Example¶
SELECT MINUTE(<col_1>)
FROM <table_name>
MONTH¶
Supported datatypes: TIMESTAMP
Extract the month from a TIMESTAMP
column.
See also
Example¶
SELECT MONTH(<col_1>)
FROM <table_name>
SECOND¶
Supported datatypes: TIMESTAMP
Extract the second from a TIMESTAMP
column.
See also
Example¶
SELECT SECOND(<col_1>)
FROM <table_name>
YEAR¶
Supported datatypes: TIMESTAMP
Extract the year from a TIMESTAMP
column.
See also
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.
Datetime part |
SQL function |
|
---|---|---|
Year value |
|
|
Month value |
|
|
Day of a month |
|
|
Day of the week |
|
|
Hour of the day |
|
|
Minute of the hour |
|
|
Second of the minute |
|
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>