Re: date_trunct() and start of week

From: Adrian Klaver <aklaver(at)comcast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Subject: Re: date_trunct() and start of week
Date: 2009-11-26 22:15:09
Message-ID: 200911261415.10017.aklaver@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday 26 November 2009 1:59:05 pm Thomas Kellerer wrote:
> Hi,
>
> while using date_trunc('week', some_date) to get the date of the first day
> of the week I noticed that it was working as expected: Monday is considered
> the start of the week.
>
> I assume this depends on some locale setting, but I can't figure out which
> it is, so I can make sure this is not "accidently" changed. I tried
> changing LC_TIME (American_America) but that still returned Monday as the
> first day (my understanding is that in the States Sunday is considered the
> start of the week)
>
> Any pointers are appreciated (did I miss it in the manual?)
>
> Regards
> Thomas

From here:
http://www.postgresql.org/docs/8.4/interactive/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC

week

The number of the week of the year that the day is in. By definition (ISO
8601), the first week of a year contains January 4 of that year. (The ISO-8601
week starts on Monday.) In other words, the first Thursday of a year is in week
1 of that year.

--
Adrian Klaver
aklaver(at)comcast(dot)net

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thom Brown 2009-11-26 22:17:10 Re: date_trunct() and start of week
Previous Message Thomas Kellerer 2009-11-26 21:59:05 date_trunct() and start of week