Subject Re: Server Date and time
Author mindmaster32
--- In firebird-support@yahoogroups.com, "Adam" <s3057043@...> wrote:
>
> --- 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
>

Very interesting!

Thank you Adam for pointing this out. Since my application only runs
in my company´s intranet I will not have the time zone issue.

Now I have several ways of doing what I need, great!

Eduardo Germani