From: | Adrian Klaver <aklaver(at)comcast(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Cc: | "Alain Roger" <raf(dot)news(at)gmail(dot)com> |
Subject: | Re: date and time |
Date: | 2008-03-24 14:51:17 |
Message-ID: | 200803240751.18040.aklaver@comcast.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Monday 24 March 2008 7:35 am, Alain Roger wrote:
> Hi,
>
> i have a stored procedure (a function) in which i must generate a date/time
> stamp.
> for that i use "select * from now();" and store the result into a column
> table.
>
> is there a easier way to do that ? i tried to store directly now(); result
> but without success.
>
> thx.
If you want the timestamp on INSERT add DEFAULT now() to column.
In a pl/pgsql function I do;
new.ts_update:=now()
where ts_update is the column I am updating.
Be aware now() records the time at the beginning of the transaction. An
alternate is clock_timestamp() which records the current time.
--
Adrian Klaver
aklaver(at)comcast(dot)net
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Kellerer | 2008-03-24 14:56:44 | Re: date and time |
Previous Message | Alain Roger | 2008-03-24 14:45:56 | Re: date and time |