Re: date and time

From: Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com>
To: Alain Roger <raf(dot)news(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: date and time
Date: 2008-03-24 16:14:14
Message-ID: 47E7D356.2020307@amsoftwaredesign.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.
>
Do you mean something like this:

CREATE OR REPLACE FUNCTION "public"."test"()
RETURNS timestamp AS
$BODY$
DECLARE
mydate_var timestamp;

BEGIN
--store the current timestamp in a variable
mydate_var = now();

RETURN mydate_var;

END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;

Later,

Tony Caduto
AM Software
http://www.amsoftwaredesign.com
Home of Lightning Admin for PostgreSQL and MySQL

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bob Pawley 2008-03-24 16:51:38 Re: Insert
Previous Message Alain Roger 2008-03-24 15:15:48 Re: date and time