Subject | Re: Server Date and time |
---|---|
Author | Adam |
Post date | 2007-03-21T22:19:47Z |
--- In firebird-support@yahoogroups.com, "mindmaster32"
<mindmaster32@...> wrote:
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
<mindmaster32@...> wrote:
>machine.
> Thank you Thomas!
>
> CURRENT_TIMESTAMP worked beautifuly. I can even do a "Select
> CURRENT_DATE, CURRENT_TIME ..." to get the values from the server
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