11.12 LOCALTIMESTAMP
Available inDSQL, PSQL, ESQL
TypeTIMESTAMP WITHOUT TIME ZONE
Syntax
1. LOCALTIMESTAMP [ (<precision>) ]
3. <precision> ::= 0 | 1 | 2 | 3
The optional precision argument is not supported in ESQL.
Table 11.12.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
LOCALTIMESTAMPwas introduced in Firebird 3.0.4 and Firebird 2.5.9 as a synonym ofCURRENT_TIMESTAMP. In Firebird 4.0,CURRENT_TIMESTAMPreturns aTIMESTAMP WITH TIME ZONEinstead of aTIMESTAMP [WITHOUT TIME ZONE], whileLOCALTIMESTAMPreturnsTIMESTAMP [WITHOUT TIME ZONE]. It is recommended to useLOCALTIMESTAMPwhen you do not need time zone information.- The default precision of
LOCALTIMEis 0 decimals, soLOCALTIMESTAMPis not the exact sum ofCURRENT_DATEandLOCALTIME, unless you explicitly specify a precision (i.e.LOCATIME(3)orLOCALTIMESTAMP(0)). - Within a PSQL module (procedure, trigger or executable block), the value of
LOCALTIMESTAMPwill 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 11.14, ‘NOW’.
Examples
1. select localtimestamp from rdb$database
2. -- returns e.g. 2008-08-13 14:20:19.6170
4. select localtimestamp(2) from rdb$database
5. -- returns e.g. 2008-08-13 14:20:23.1200
See alsoSection 11.5, CURRENT_TIMESTAMP, Section 11.11, LOCALTIME
