Re: date and time - Mailing list pgsql-general

From Tony Caduto
Subject Re: date and time
Date
Msg-id 47E7D356.2020307@amsoftwaredesign.com
Whole thread Raw
In response to date and time  ("Alain Roger" <raf.news@gmail.com>)
List 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

pgsql-general by date:

Previous
From: "Alain Roger"
Date:
Subject: Re: date and time
Next
From: Bob Pawley
Date:
Subject: Re: Insert