Search Postgresql Archives

Re: date and time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx

-
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux