>  First day in week is Monday in ISO week.
>  Thomas, we have ISO week-of-year (IW in to_char or 'week' in date_part),
> but we haven't ISO day-of-week (may be as 'ID' for to_char).
> TODO for 7.2?
> ..but in ISO is 0-6; 0=Mon

I've been ignoring this until now, hoping no one would notice ;)

Unix day-of-week starts on Sunday, not Monday, which is what
date_trunc('dow',...) returns. Presumably this is modeled on the
traditional notion (at least in the US; I suspect this is true in most
European countries at least) of Sunday being "the first day of week".

The implementation predates our support of ISO dates so it was not an
issue then.

date_part() is modeled on Ingres' implementation, but my old Ingres
manual indicates that 'dow' is not one of the options.

Should we change the definition of "dow", or implement another choice,
say "idow"?

Comments?

                       - Thomas

Wed, 14 Mar 2001 14:50:35 +0000
Thomas Lockhart <lockhart@alumni.caltech.edu>
Re: Week number
On Wed, Mar 14, 2001 at 02:50:35PM +0000, Thomas Lockhart wrote:
> >  First day in week is Monday in ISO week.
> >  Thomas, we have ISO week-of-year (IW in to_char or 'week' in date_part),
> > but we haven't ISO day-of-week (may be as 'ID' for to_char).
> > TODO for 7.2?
> > ..but in ISO is 0-6; 0=Mon
> 
> I've been ignoring this until now, hoping no one would notice ;)
> 
> Unix day-of-week starts on Sunday, not Monday, which is what
> date_trunc('dow',...) returns. Presumably this is modeled on the
> traditional notion (at least in the US; I suspect this is true in most
> European countries at least) of Sunday being "the first day of week".
> 
> The implementation predates our support of ISO dates so it was not an
> issue then.
> 
> date_part() is modeled on Ingres' implementation, but my old Ingres
> manual indicates that 'dow' is not one of the options.
> 
> Should we change the definition of "dow", or implement another choice,
> say "idow"?

 Yes, I agree with new "idow" for date_part() and 'ID' for to_char() stuff.


 My note grow up when I do SQL query that say something like: 

"2001-03-12 is begin of week and it's second day of week" .. this sound 
very curious :-)


 test=# select to_char('2001-03-12'::date, 'IW Dth Day');
     to_char
------------------
 11 2nd Monday
(1 row)

		Karel

-- 
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/
 
 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

Wed, 14 Mar 2001 16:10:01 +0100
Karel Zak <zakkr@zf.jcu.cz>
Re: Week number

> traditional notion (at least in the US; I suspect this is true in most
> European countries at least) of Sunday being "the first day of week".

I believe that in most European countries, Monday is the first day of the 
week.

-- 
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2501
Howitzvej 75               ï¿½ben 14.00-18.00        Email: kar@webline.dk
2000 Frederiksberg        Lï¿½rdag 11.00-17.00       Web:      www.suse.dk

Wed, 14 Mar 2001 23:53:53 +0100
Kaare Rasmussen <kar@webline.dk>
Re: Re: Week number