RE: Find all the dates in the calendar week?

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Andrew Snow <als(at)fl(dot)net(dot)au>
Cc: Stephane Bortzmeyer <bortzmeyer(at)pasteur(dot)fr>, "Pgsql-General(at)Postgresql(dot) Org" <pgsql-general(at)postgresql(dot)org>
Subject: RE: Find all the dates in the calendar week?
Date: 2000-07-06 13:21:53
Message-ID: Pine.LNX.3.96.1000706150155.14481B-100000@ara.zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Thu, 6 Jul 2000, Andrew Snow wrote:

> > See the documentation at:
> > http://www.comptechnews.com/~reaster/postgres/functions2976.htm
>
>
> So, something like:
>
> SELECT event FROM events WHERE to_char(CURRENT_TIMESTAMP, 'ww') =
> to_char(eventdate, 'ww');

A small note about 'WW' in to_char/timestamp(), in 7.0 is a small bug
in this code (already discussed) and it is based on standard weeks, but in
7.1 it will *different* and based on weeks like Oracle (already in CVS).

Oracle: first week start JAN-1 and all next weeks start in same day. For
example if first day of year is friday, all weeks start in friday.

ISO-week: week that has more than 4 day and start in Sunday.

In future I try implement 'IW' that is ISO-week, but now I work on different
things.

In current 7.0 is probably better for week operations use
date_part('week', TIMESTAMP) than to_char().

Karel

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Lockhart 2000-07-06 13:31:09 Re: change in now() and ago with 7.x
Previous Message The Hermit Hacker 2000-07-06 13:07:19 Re: PostgreSQL & the BSD License