community.borland.com

Article #25797: Does InterBase support DATE literals, if yes how do I use them?

Problem:
I have heard about DATE literals like 'today'.  What UDF do I need
and how do I use them.

Solution:
InterBase supports four DATE literals.  They are:

  'today', 'yesterday', 'tomorrow' and 'now'

They are all InterBase keywords to be used only with the 
DATE data type.  These are functions internal to the InterBase 
engine thus, there are no UDFs involved or needed.  
This is Documented on pages 105 and 179 of 
the InterBase version 5.5 Programmer's Guide.

In order to use string literals in a SELECT statement
one must use CAST.   
Please see the example below:

select cast('now' as DATE) from rdb$database

The string literals can also be used in an INSERT or UPDATE
statement.  Consider the following schema:

  (example schema) 
  create table t1 (
    pkey integer,
    f1date
   );

   (examples)
   insert into t1 (pkey, f1) values (1, 'now')
   update t1 set f1 = 'now' where pkey = ?

Last Modified: 27-OCT-00