Subject | Re: EXTRACT(WEEK FROM DATE) - how to get the right year? |
---|---|
Author | Thomas Kellerer |
Post date | 2008-12-21T12:01:17Z |
--- In firebird-support@yahoogroups.com, Dom Scarlatti >
There are different system on what the "first" week is:
http://en.wikipedia.org/wiki/Week#Week_number
> alter table xyzJust be careful in which area of the world you are.
> add WeekOfTheYear
> computed by (
>
> case
> when (extract(month from CertainDate) = 12)
> and (extract(week from CertainDate) = 1)
> then
> 'Week '||extract (WEEK from CertainDate)||' of year '
> || (1 + (extract( year from CertainDate)))
>
> else 'Week '||extract (WEEK from CertainDate)||' of year '
> ||extract( year from CertainDate)
> end )
>
> Dom
>
There are different system on what the "first" week is:
http://en.wikipedia.org/wiki/Week#Week_number