Firebird Documentation IndexFirebird 2.0 Language Ref. UpdateContext variables → 'NOW'
Firebird Home Firebird Home Prev: NEWFirebird Documentation IndexUp: Context variablesNext: OLD

'NOW'

Tip

Find a more recent version at Firebird 5.0 Language Reference: 'NOW'

Available in: DSQL, PSQL, ESQL

Changed in: 2.0

Description: 'NOW' is not a variable but a string literal. It is, however, special in the sense that when you CAST() it to a date/time type, you will get the current date and/or time. The fractional part of the time used to be always .0000, giving an effective seconds precision. In Firebird 2.0 the precision is 3 decimals, i.e. milliseconds. 'NOW' is case-insensitive, and the engine ignores leading or trailing spaces when casting.

Type: CHAR(3)

Examples: 

select 'Now' from rdb$database
-- returns 'Now'
select cast('Now' as date) from rdb$database
-- returns e.g. 2008-08-13
select cast('now' as time) from rdb$database
-- returns e.g. 14:20:19.6170
select cast('NOW' as timestamp) from rdb$database
-- returns e.g. 2008-08-13 14:20:19.6170

Shorthand syntax for the last three statements:

select date 'Now' from rdb$database
select time 'now' from rdb$database
select timestamp 'NOW' from rdb$database

Notes: 

Prev: NEWFirebird Documentation IndexUp: Context variablesNext: OLD
Firebird Documentation IndexFirebird 2.0 Language Ref. UpdateContext variables → 'NOW'