Re: Automatic date/time - Mailing list pgsql-novice

From John Christopher
Subject Re: Automatic date/time
Date
Msg-id dv3sid$7p0$1@sea.gmane.org
Whole thread Raw
In response to Automatic date/time  (Joao Miguel Ferreira <jmf@estg.ipvc.pt>)
Responses Re: Automatic date/time  (Michael Glaesemann <grzm@myrealbox.com>)
Re: Automatic date/time  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-novice
Hello,
To follow up on that, how to make sure the timestamp is always stored and
displayed at, for instance, time zone 'zulu'
Something like
create table ...
{
   datetime timestamptz default 'now() at time zone \'zulu\''
}
does not work; PostgreSQL complains about the syntax. Any idea.
Many thanks
JCR

"Sean Davis" <sdavis2@mail.nih.gov> wrote in message
news:C03AC283.7E86%sdavis2@mail.nih.gov...
>
>
>
> On 3/13/06 6:19 AM, "Joao Miguel Ferreira" <jmf@estg.ipvc.pt> wrote:
>
>> Hello all,
>>
>> is it possible to have Pg automatically insert a Date or Time value on a
>> record if the INSERT comand does not include one ?
>>
>> Something similar to AUTO INCREMENT for INTs ?!?!
>>
>> This way the program that does the INSERT wouldn't have to worry about
>> the correct Date/Time value nor format....
>
> Look at setting defaults and set the default to something like 'now()'.
>
> Create table .... (
>
>    mydate date default 'now()',
>
> );
>
> Sean
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>



pgsql-novice by date:

Previous
From: Sean Davis
Date:
Subject: Re: Automatic date/time
Next
From: Michael Glaesemann
Date:
Subject: Re: Automatic date/time