Re: date_trunct() and start of week

From: Rikard Bosnjakovic <rikard(dot)bosnjakovic(at)gmail(dot)com>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: date_trunct() and start of week
Date: 2009-11-27 07:49:42
Message-ID: d9e88eaf0911262349i3055ccbbmb3dd69d0371267d3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Nov 27, 2009 at 08:13, Thomas Kellerer <spam_eater(at)gmx(dot)net> wrote:

[...]
> I'm just curious which setting defines whether monday or sunday is
> considered the "first day in a week"

Read 9.9.2 on http://www.postgresql.org/docs/8.1/static/functions-datetime.html
and you will see that even if you find such setting, date_trunc() will
always return monday as start of week:

=========[snip]
source is a value expression of type timestamp or interval. (Values of
type date and time are cast automatically, to timestamp or interval
respectively.) field selects to which precision to truncate the input
value. The return value is of type timestamp or interval with all
fields that are less significant than the selected one set to zero (or
one, for day and month).
=========[snip]

Atleast that's how I interpret the last parenthesis in the paragraph.

--
- Rikard

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2009-11-27 08:16:41 Re: date_trunct() and start of week
Previous Message Thomas Kellerer 2009-11-27 07:13:52 Re: date_trunct() and start of week