9.11. LOCALTIME
Available inDSQL, PSQL, ESQL
TypeTIME
Syntax
LOCALTIME [ (<precision>) ]
<precision> ::= 0 | 1 | 2 | 3
The optional precision argument is not supported in ESQL.
LOCALTIME Parameter| Parameter | Description |
|---|---|
precision | Precision. The default value is 0. Not supported in ESQL |
LOCALTIME returns the current server time.
The default is 0 decimals, i.e. seconds precision.
LOCALTIMEwas introduced in Firebird 2.5.9 as an alias of Section 9.4, “CURRENT_TIME”. In Firebird 4,CURRENT_TIMEwill return aTIME WITH TIME ZONEinstead of aTIME [WITHOUT TIME ZONE], whileLOCALTIMEwill continue to returnTIME [WITHOUT TIME ZONE]. It is recommended to switch fromCURRENT_TIMEtoLOCALTIMEfor forward-compatibility with Firebird 4.LOCALTIMEhas a default precision of 0 decimals, where Section 9.12, “LOCALTIMESTAMP” has a default precision of 3 decimals. As a result,LOCALTIMESTAMPis not the exact sum of Section 9.2, “CURRENT_DATE” andLOCALTIME, unless you explicitly specify a precision (i.e.LOCALTIME(3)orLOCALTIMESTAMP(0)).Within a PSQL module (procedure, trigger or executable block), the value of
LOCALTIMEwill remain constant every time it is read. If multiple modules call or trigger each other, the value will remain constant throughout the duration of the outermost module. If you need a progressing value in PSQL (e.g. to measure time intervals), use Section 9.14, “'NOW'”.
Examples
select localtime from rdb$database
-- returns e.g. 14:20:19.0000
select localtime(2) from rdb$database
-- returns e.g. 14:20:23.1200
See alsoSection 9.4, “CURRENT_TIME”, Section 9.12, “LOCALTIMESTAMP”