9.17 'TODAY'

Available inDSQL, PSQL, ESQL


Description'TODAY' 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. 'TODAY' is case-insensitive, and the engine ignores leading or trailing spaces when casting.


select 'Today' from rdb$database
-- returns 'Today'
select cast('Today' as date) from rdb$database
-- returns e.g. 2011-10-03
select cast('TODAY' as timestamp) from rdb$database
-- returns e.g. 2011-10-03 00:00:00.0000

Shorthand syntax for the last two statements:

select date 'Today' from rdb$database;
select timestamp 'TODAY' from rdb$database;
  • 'TODAY' always returns the actual date, even in PSQL modules, where Section 9.2, CURRENT_DATE, Section 9.4, CURRENT_TIME and Section 9.5, CURRENT_TIMESTAMP return the same value throughout the duration of the outermost routine. This makes 'TODAY' useful for measuring time intervals in triggers, procedures and executable blocks (at least if your procedures are running for days).

  • Except in the situation mentioned above, reading CURRENT_DATE, is generally preferable to casting 'NOW'.