Re: Week number

From: Jason Earl <jason(dot)earl(at)simplot(dot)com>
To: "Wodzu" <wodzu(at)wodzus(dot)prv(dot)pl>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Week number
Date: 2001-11-28 16:45:09
Message-ID: 87wv0an8tm.fsf@npa01zz001.simplot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Both

SELECT extract(week FROM now());

and

SELECT extract(week FROM CURRENT_TIMESTAMP);

work as expected. I don't know which is the *accepted* SQL 92
idiom, but I would bet that it isn't 'now().'

Jason

"Wodzu" <wodzu(at)wodzus(dot)prv(dot)pl> writes:

> Hi all,
>
> I'm novice in PostgreSQL.
> I want to obtain current week number.
> Under PHP I try:
>
> $query = "SELECT EXTRACT(WEEK FROM NOW)";
> $result= pg_exec($dbconn,$query);
>
> where: $dbconn - successful conection id
> But this give me an error message.
> Can somebody help me?
> Sorry for my english.
>
> Thanks in advice.
>
> Wodzu
>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Doug McNaught 2001-11-28 16:46:20 Re: FW: [ppa-dev] Severe bug in debian - phppgadmin opens up
Previous Message Vincent.Gaboriau 2001-11-28 16:44:50 Re: [HACKERS] upper and lower doesn't work with german