Re: extract (dow/week from date)

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Clodoaldo Pinto <clodoaldo(dot)pinto(at)gmail(dot)com>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, "pgsql-general postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: extract (dow/week from date)
Date: 2005-08-21 04:17:00
Message-ID: 20050821041700.GF21765@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Aug 20, 2005 at 08:49:27PM -0700, Stephan Szabo wrote:
> On Sat, 20 Aug 2005, Tom Lane wrote:
>
> > Clodoaldo Pinto <clodoaldo(dot)pinto(at)gmail(dot)com> writes:
> > > I'm ordering by date just to show that sunday, the 0th day of the
> > > week, is the last day of a given week, which is not what I need.
> >
> > extract(week) follows the ISO definition of week, which is pretty
> > strange anyway, but in particular it says that weeks start on Monday.
> > extract(dow) follows a different convention. There's not a lot we
> > can do about this --- we're certainly not going to change extract(week),
> > and I can't see changing extract(dow) either.
>
> Instead of change the existing ones, couldn't we add a new extract format
> for "iso day of week" that returns 1-7 for monday-sunday that would be
> consistent with the week definition?

AFAIR the to_char() function uses the 1-7 convention.

--
Alvaro Herrera (<alvherre[a]alvh.no-ip.org>)
"I personally became interested in Linux while I was dating an English major
who wouldn't know an operating system if it walked up and bit him."
(Val Henson)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John Craddock 2005-08-21 06:16:39 Windows Installer
Previous Message Stephan Szabo 2005-08-21 03:49:27 Re: extract (dow/week from date)