Re: date and time

From: "Alain Roger" <raf(dot)news(at)gmail(dot)com>
To: rod(at)iol(dot)ie
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: date and time
Date: 2008-03-24 14:45:56
Message-ID: 75645bbb0803240745l43023c17g9668a3cf09219f2c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Ray,

yes for sure. Here it is:

> SELECT count(*) INTO existing_email FROM cust_portal.tmp_newsletterreg;
> if (existing_email <>0) then
> {
> result = false;
> }
> else
> {
> result = true;
> INSERT INTO cust_portal.tmp_newsletterreg VALUES
> (
> nextval( 'tmp_newsletterreg_nlreg_id_seq' ),
> email,
> session,
> SELECT CURRENT_TIMESTAMP;
> )
> }
> end if;
>
> RETURN(result);
>

On Mon, Mar 24, 2008 at 3:42 PM, Raymond O'Donnell <rod(at)iol(dot)ie> wrote:

> On 24/03/2008 14:35, Alain Roger wrote:
> > 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.
>
> Can you show us the full SQL statement?
>
> You could also use CURRENT_TIMESTAMP - look at the following:
>
>
> http://www.postgresql.org/docs/8.3/static/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT
>
> HTH,
>
> Ray.
>
>
> ---------------------------------------------------------------
> Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
> rod(at)iol(dot)ie
> ---------------------------------------------------------------
>

--
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2008-03-24 14:51:17 Re: date and time
Previous Message Raymond O'Donnell 2008-03-24 14:42:04 Re: date and time