Subject Re: Server Date and time
Author Adam
--- In firebird-support@yahoogroups.com, "mindmaster32"
<mindmaster32@...> wrote:
>
> Thank you Thomas!
>
> CURRENT_TIMESTAMP worked beautifuly. I can even do a "Select
> CURRENT_DATE, CURRENT_TIME ..." to get the values from the server
machine.

The other thing you can do is something like

CREATE TABLE FOO
(
ID INTEGER,
BAR INTEGER,
CREATETIME TIMESTAMP DEFAULT CURRENT_TIME
);

Then

Insert into Foo (1, 2);

will insert the time into create time. You can do even more if you use
triggers.

The main 'gotchas' is that these values return the local time at the
database server, so can not always be used if you have some clients
running in different time zones. In that case, you will have to write
your own UDF to retrieve UTC time. The other one is that there is also
the literal 'NOW' which has a subtle difference to CURRENT_TIMESTAMP
in that one of them is kept constant for the entire operation.

Adam