Re: [GENERAL] date_trunct() and start of week

2009-11-27 Thread Tom Lane
Thomas Kellerer writes: > I'm just curious which setting defines whether monday or sunday is considered > the "first day in a week" A look at the source code (timestamptz_trunc) shows that truncation to week start follows the ISO week conventions --- so weeks start on Monday, regardless of local

Re: [GENERAL] date_trunct() and start of week

2009-11-27 Thread Alban Hertroys
On 27 Nov 2009, at 8:49, Rikard Bosnjakovic wrote: > 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 express

Re: [GENERAL] date_trunct() and start of week

2009-11-27 Thread Thomas Kellerer
Thomas Markus, 27.11.2009 09:41: Hi, not all to zero : "that are less significant than the selected one set to zero (or one, for day and month)" Sorry, I missed the "or one" part. see http://www.postgresql.org/docs/8.1/static/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT dow: "The day o

Re: [GENERAL] date_trunct() and start of week

2009-11-27 Thread Thomas Markus
Hi, not all to zero : "that are less significant than the selected one set to zero (or one, for day and month)" so select extract('dow' from date_trunc('week', current_date)) returns always 1 (i think accordingly to ISO-8601) see http://www.postgresql.org/docs/8.1/static/functions-datetime.htm

Re: [GENERAL] date_trunct() and start of week

2009-11-27 Thread Thomas Kellerer
Rikard Bosnjakovic, 27.11.2009 08:49: [...] 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()

Re: [GENERAL] date_trunct() and start of week

2009-11-26 Thread Rikard Bosnjakovic
On Fri, Nov 27, 2009 at 08:13, Thomas Kellerer 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 sett

Re: [GENERAL] date_trunct() and start of week

2009-11-26 Thread Thomas Kellerer
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 depend

Re: [GENERAL] date_trunct() and start of week

2009-11-26 Thread Thom Brown
2009/11/26 Thomas Kellerer > 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

Re: [GENERAL] date_trunct() and start of week

2009-11-26 Thread Thom Brown
2009/11/26 Thomas Kellerer > 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

Re: [GENERAL] date_trunct() and start of week

2009-11-26 Thread Adrian Klaver
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

[GENERAL] date_trunct() and start of week

2009-11-26 Thread Thomas Kellerer
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 "a