Re: date_trunct() and start of week
| От | Thomas Kellerer |
|---|---|
| Тема | Re: date_trunct() and start of week |
| Дата | |
| Msg-id | henu7b$cv6$1@ger.gmane.org обсуждение исходный текст |
| Ответ на | Re: date_trunct() and start of week (Adrian Klaver <aklaver@comcast.net>) |
| Ответы |
Re: date_trunct() and start of week
Re: date_trunct() and start of week |
| Список | pgsql-general |
Adrian Klaver, 26.11.2009 23:15:
> 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.
>
Thanks for the answer, I'm aware of the week numbering but that's not what I'm interested in.
When I pass e.g. today's date (27.11.) I want the *date* returned of the monday of that week (23.11.)
Which is what date_trunc('week', some_date) gives me.
That is not my question
I'm just curious which setting defines whether monday or sunday is considered the "first day in a week"
Regards
Thomas
В списке pgsql-general по дате отправления: