CURRENT_TIMESTAMP

<< CURRENT_TIME | FB 2.5 Language Reference | CURRENT_TRANSACTION >>
<< CURRENT_TIME | FB 2.1 Language Reference | CURRENT_TRANSACTION >>
<< CURRENT_TIME | FB 2.0 Language Reference | CURRENT_TRANSACTION >>

CURRENT_TIMESTAMP

Available in: DSQL, PSQL, ESQL

Changed in: 2.0

Description

CURRENT_TIMESTAMP returns the current server date and time. In versions prior to 2.0, the fractional part used to be always .0000, giving an effective precision of 0 decimals. From Firebird 2.0 onward you can specify a precision when polling this variable. The default is 3 decimals, i.e. milliseconds precision.

Type: TIMESTAMP

Syntax

 CURRENT_TIMESTAMP [(precision)]

 precision ::= 0 | 1 | 2 | 3

The optional precision argument is not supported in ESQL.

Examples

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

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

Notes:

  • The default precision of CURRENT_TIME is still 0 decimals, so in Firebird 2.0 and up CURRENT_TIMESTAMP is no longer the exact sum of CURRENT_DATE and CURRENT_TIME, unless you explicitly specify a precision.
  • Within a PSQL module (procedure, trigger or executable block), the value of CURRENT_TIMESTAMP 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 'NOW'.

See also:
CURRENT_TIMESTAMP now returns milliseconds by default
The difference between CURRENT_TIMESTAMP and 'NOW'
'NOW'
TIME ZONE

back to top of page
<< CURRENT_TIME | FB 2.5 Language Reference | CURRENT_TRANSACTION >>
<< CURRENT_TIME | FB 2.1 Language Reference | CURRENT_TRANSACTION >>
<< CURRENT_TIME | FB 2.0 Language Reference | CURRENT_TRANSACTION >>