FirebirdSQL logo

LOCALTIME

Current server time in the session time zone, without time zone information

Type

TIME WITHOUT TIME ZONE

Syntax
LOCALTIME [ (<precision>) ]

<precision> ::= 0 | 1 | 2 | 3

The optional precision argument is not supported in ESQL.

Table 1. LOCALTIME Parameter
Parameter Description

precision

Precision.The default value is 0.Not supported in ESQL

LOCALTIME returns the current server time in the session time zone.The default is 0 decimals, i.e. seconds precision.

Note
  • LOCALTIME was introduced in Firebird 3.0.4 and Firebird 2.5.9 as an alias of CURRENT_TIME.In Firebird 5.0, CURRENT_TIME returns a TIME WITH TIME ZONE instead of a TIME [WITHOUT TIME ZONE], while LOCALTIME returns TIME [WITHOUT TIME ZONE].It is recommended to use LOCALTIME when you do not need time zone information.

  • LOCALTIME has a default precision of 0 decimals, where LOCALTIMESTAMP has a default precision of 3 decimals.As a result, LOCALTIMESTAMP is not the exact sum of CURRENT_DATE and LOCALTIME, unless you explicitly specify a precision (i.e. LOCALTIME(3) or LOCALTIMESTAMP(0)).

  • Within a PSQL module (procedure, trigger or executable block), the value of LOCALTIME will 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 [fblangref50-contextvars-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

LOCALTIMESTAMP

Current server time and date in the session time zone, without time zone information

Type

TIMESTAMP WITHOUT TIME ZONE

Syntax
LOCALTIMESTAMP [ (<precision>) ]

<precision> ::= 0 | 1 | 2 | 3

The optional precision argument is not supported in ESQL.

Table 1. LOCALTIMESTAMP Parameter
Parameter Description

precision

Precision.The default value is 3.Not supported in ESQL

LOCALTIMESTAMP returns the current server date and time in the session time zone.The default is 3 decimals, i.e. milliseconds precision.

Note
  • LOCALTIMESTAMP was introduced in Firebird 3.0.4 and Firebird 2.5.9 as a synonym of CURRENT_TIMESTAMP.In Firebird 5.0, CURRENT_TIMESTAMP returns a TIMESTAMP WITH TIME ZONE instead of a TIMESTAMP [WITHOUT TIME ZONE], while LOCALTIMESTAMP returns TIMESTAMP [WITHOUT TIME ZONE].It is recommended to use LOCALTIMESTAMP when you do not need time zone information.

  • The default precision of LOCALTIME is 0 decimals, so LOCALTIMESTAMP is not the exact sum of CURRENT_DATE and LOCALTIME, unless you explicitly specify a precision (i.e. LOCATIME(3) or LOCALTIMESTAMP(0)).

  • Within a PSQL module (procedure, trigger or executable block), the value of LOCALTIMESTAMP will 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 [fblangref50-contextvars-now].

Examples
select localtimestamp from rdb$database
-- returns e.g. 2008-08-13 14:20:19.6170

select localtimestamp(2) from rdb$database
-- returns e.g. 2008-08-13 14:20:23.1200