You write FedSQL date,
time, or datetime constants using the following syntax:
DATE 'yyyy-mm-dd'
TIME 'hh:nn:ss[.fraction]'
TIMESTAMP ' yyyy-mm-dd hh:mm:ss[.fraction]'
where
-
yyyy is
a four-digit year
-
mm is
a two-digit month, 01–12
-
dd is
a two-digit day, 01–31
-
hh is
a two-digit military hour, 00–23
-
nn is
a two-digit minute, 00–59
-
ss is
a two-digit second, 00–61
-
fraction can
be one to ten digits, 0–9, is optional, and represents a fraction
of a second
The string portion of
the value after the DATE, TIME, or TIMESTAMP keyword must be enclosed
in single quotation marks.
In the date constant,
the hyphens are required and the length of the date string must be
10.
In the time constant,
the colons are required. If the fraction of a second is not present,
the time string must be eight characters long and it can include or
exclude the period. If the fraction of second is present, the fraction
can be up to nine digits long. The time constant can be between 8
and 18 characters long.
In the timestamp constant,
the hyphens in the date are required as well as the colons in the
time. If the fraction of a second is not present, it can include or
exclude the period. If fraction of a second is present, the fraction
can be up to nine digits long. The timestamp constant can be between
19 and 29 characters long.
The following are examples
of FedSQL date, time, and timestamp constants:
date'2008-01-31'
time'20:44:59'
timestamp'2007-02-02 07:00:00.7569'
The following is an
example of creating a table that includes datetime values:
create table bikerace (name char(30), entry_number int,
registration_date timestamp);
insert into bikerace values ('Andersen, Mark', 342,
timestamp'2007-03-15 12:27:33');
insert into bikerace values ('Steinbek, Mark', 244,
timestamp'2006-11-27 13:26:19');