Using Date Literals
Go Up to Working with Dates and Times
InterBase supports the following date literals: 'NOW'
, ‘TODAY
’, 'YESTERDAY'
, and 'TOMORROW'
. Date literals are string values, entered between single quotation marks, that can be interpreted as date values for EXTRACT
, SELECT
, INSERT
, and UPDATE
operations. 'NOW'
is a date literal that combines today’s date and time in InterBase format. 'TODAY'
is today’s date with time information set to zero. Similarly, 'YESTERDAY'
and 'TOMORROW'
are the expected dates with the time information set to zero.
In EXTRACT
and SELECT
, 'TODAY'
and 'NOW'
can be used in the search condition of a WHERE
clause to restrict the data retrieved:
EXEC SQL SELECT * FROM CROSS_RATE WHERE UPDATE_DATE = 'NOW';
In INSERT
and UPDATE
, 'TODAY'
and 'NOW'
can be used to enter date and time values instead of relying on isc
calls to convert C dates to InterBase dates:
EXEC SQL INSERT INTO CROSS_RATE VALUES(:from, :to, :rate, 'NOW'); EXEC SQL UPDATE CROSS_RATE SET CONV_RATE = 1.75, SET UPDATE_DATE = 'TODAY' WHERE FROM_CURRENCY = 'POUND' AND TO_CURRENCT = 'DOLLAR' AND UPDATE_DATE < 'TODAY';