DSQL, ESQL, PSQL
Syntax
Result type
SMALLINT
or NUMERIC
Description
Extracts and returns an element from a DATE
, TIME
or TIMESTAMP
expression. This function was already added in InterBase 6, but not documented in the Language Reference at the time.
The returned data types and possible ranges are shown in the table below. If you try to extract a part that isn’t present in the date/time argument (e.g. SECOND
from a DATE
or YEAR
from a TIME
), an error occurs.
Description
Firebird 2.1 and up support extraction of the millisecond from a TIME
or TIMESTAMP
. The datatype returned is NUMERIC(9,1)
.
Description
Firebird 2.1 and up support extraction of the ISO-8601 week number from a DATE
or TIMESTAMP
. ISO-8601 weeks start on a Monday and always have the full seven days. Week 1 is the first week that has a majority (at least 4) of its days in the new year. The first 1-3 days of the year may belong to the last week (52 or 53) of the previous year. Likewise, a year’s final 1-3 days may belong to week 1 of the following year.
See also