Subject | Re: extract(week from d) |
---|---|
Author | lacakus |
Post date | 2006-12-01T06:49:13Z |
I made some test :
MS SQL : DATEPART(week,datum)
select datepart(week, '2005-01-01');
compliant
SELECT week('2005-01-01',3), weekofyear('2005-01-01');
select extract(week from date'2005-01-01');
Firebird ...
-Laco.
MS SQL : DATEPART(week,datum)
select datepart(week, '2005-01-01');
>1select datepart(week, '2006-01-01');
>1select datepart(week, '2006-01-02');
>1select datepart(week, '2007-01-01');
>1MySQL : WEEK(date[,mode]), WEEKOFYEAR()=WEEK(date,3) -> ISO8601
compliant
SELECT week('2005-01-01',3), weekofyear('2005-01-01');
>53SELECT week('2006-01-01',3), weekofyear('2006-01-01');
>52SELECT week('2006-01-02',3), weekofyear('2006-01-02');
>1SELECT week('2007-01-01',3), weekofyear('2007-01-01');
>1PostgreSQL: EXTRACT(WEEK FROM datum) -> ISO8601 compliant
select extract(week from date'2005-01-01');
>53select extract(week from date'2006-01-01');
>52select extract(week from date'2006-01-02');
>1select extract(week from date'2007-01-01');
>1MySQL and PostgreSQL follows ISO, so this is IMHO the way for
Firebird ...
-Laco.