Skip site navigation (1) Skip section navigation (2)

Re: Week number

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Markus Bertheau" <twanger(at)bluetwanger(dot)de>, "Wodzu" <wodzu(at)wodzus(dot)prv(dot)pl>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Week number
Date: 2001-11-29 01:47:05
Message-ID: GNELIHDDFBOCMGBFGEFOAEJJCAAA.chriskl@familyhealth.com.au (view raw or flat)
Thread:
Lists: pgsql-hackers
> Then pgsql-novice is the correct list to ask this kind of question.
> > I want to obtain current week number.
> > Under PHP I try:
> >
> > $query = "SELECT EXTRACT(WEEK FROM NOW)";
> > $result= pg_exec($dbconn,$query);
>
> select date_part('week', CURRENT_TIMESTAMP);

I'll just point out that using date_part isn't ANSI SQL, you should use the
EXTRACT function, and the CURRENT_DATE, CURRENT_TIME and CURRENT_TIMESTAMP
variables.

Chris


In response to

pgsql-hackers by date

Next:From: Christopher Kings-LynneDate: 2001-11-29 01:58:58
Subject: Re: FW: [ppa-dev] Severe bug in debian - phppgadmin opens up
Previous:From: Christopher Kings-LynneDate: 2001-11-29 01:43:41
Subject: Re: Week number

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group