Re: extract (dow/week from date)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: 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 17:36:49
Message-ID: 3230.1124645809@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> Yeah, mod is probably better and more general than case. It's still fairly
> ugly to require a non-trivial expression to get something that's
> consistent with the way that extract(week from date) works. ;)

> For anyone who is considering using this, to get an actual iso day of
> week, I think you'll need to add 1 at the end since that appears to use a
> 1-7 range. If you're just using it for sorting or the like, you can get
> away with not bothering.

Yeah. If we were to invent an extract(isodow) option, I'd be inclined
to make it return 1-7 Mon-Sun. So it'd actually produce the same value
as extract(dow), except on Sundays.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alex 2005-08-21 17:58:25 Help with plperl
Previous Message Madison Kelly 2005-08-21 17:29:35 Re: How to get '-' in katakana with canna server