Re: Setting week starting day - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: Setting week starting day
Date
Msg-id 20070309212942.GA27224@wolff.to
Whole thread Raw
In response to Re: Setting week starting day  (Jorge Godoy <jgodoy@gmail.com>)
Responses Re: Setting week starting day  (Jorge Godoy <jgodoy@gmail.com>)
List pgsql-general
On Fri, Mar 09, 2007 at 16:44:57 -0300,
  Jorge Godoy <jgodoy@gmail.com> wrote:
> Bruno Wolff III <bruno@wolff.to> writes:
>
> > On Fri, Mar 09, 2007 at 14:59:35 -0300,
> >   Jorge Godoy <jgodoy@gmail.com> wrote:
> >> It is not hard to calculate, as you can see... but it would be nice if
> >> "date_trunc('week', date)" could do that directly.  Even if it became
> >> "date_trunc('week', date, 4)" or "date_trunc('week', date, 'Wednesday')" it
> >> would be nice...  :-)  And that is what I was trying to ask ;-)
> >
> > Use date_trunc('week', current_day + 1) and date_trunc('dow', current_day + 1)
> > to have a one day offset from the standard first day of the week.
>
>
> I believe there's more than that...  Probably the "+1" should be outside the
> date_trunc, anyway.  It might help, but I still see the need to to do
> calculations...  Specially if it was Tuesday today...

No, it has to be inside the function so that the modular arithmetic is
applied to it.

pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: "oracle to postgresql" conversion
Next
From: Karsten Hilbert
Date:
Subject: Re: HIPPA (was Re: Anyone know ...)