Subject Re: extract(week from d)
Author lacakus
I made some test :

MS SQL : DATEPART(week,datum)
select datepart(week, '2005-01-01');
>1
select datepart(week, '2006-01-01');
>1
select datepart(week, '2006-01-02');
>1
select datepart(week, '2007-01-01');
>1

MySQL : WEEK(date[,mode]), WEEKOFYEAR()=WEEK(date,3) -> ISO8601
compliant
SELECT week('2005-01-01',3), weekofyear('2005-01-01');
>53
SELECT week('2006-01-01',3), weekofyear('2006-01-01');
>52
SELECT week('2006-01-02',3), weekofyear('2006-01-02');
>1
SELECT week('2007-01-01',3), weekofyear('2007-01-01');
>1

PostgreSQL: EXTRACT(WEEK FROM datum) -> ISO8601 compliant
select extract(week from date'2005-01-01');
>53
select extract(week from date'2006-01-01');
>52
select extract(week from date'2006-01-02');
>1
select extract(week from date'2007-01-01');
>1


MySQL and PostgreSQL follows ISO, so this is IMHO the way for
Firebird ...

-Laco.