RE: Find all the dates in the calendar week?

From: "Andrew Snow" <als(at)fl(dot)net(dot)au>
To: "Stephane Bortzmeyer" <bortzmeyer(at)pasteur(dot)fr>
Cc: "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 08:05:40
Message-ID: NHEALMDKDACEIPBNOOOCMEPMCGAA.als@fl.net.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> I have a table of events with a column which stores datetimes. I
> want to check
> if a datetime is inside the current calendar week (i.e. from the previous
> monday to the next sunday). The purpose is to SELECT all the
> events of the
> week.

See this posting:

> -----Original Message-----
> Sent: Tuesday, 4 July 2000 6:01 PM
> To: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] number of weeks
>
> -- Week number of the year
> to_char(CURRENT_TIMESTAMP, 'WW');
> -- Day number of the year
> to_char(CURRENT_TIMESTAMP, 'DDD');
>
> 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');

Regards,
Andrew Snow

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gilles DAROLD 2000-07-06 08:09:27 Re: Two questions in a row
Previous Message Gilles DAROLD 2000-07-06 07:50:59 Re: Two questions in a row