Subject | Re: [firebird-support] Re: EXTRACT(WEEK FROM DATE) - how to get the right year? |
---|---|
Author | Dom Scarlatti |
Post date | 2008-12-21T13:14:37Z |
At 11:01 PM 21/12/2008, you wrote:
Dom
>--- In firebird-support@yahoogroups.com, Dom Scarlatti >Firebird complies with the ISO standard. You can't tweak it to work some other way, so using this method doesn't depend on where you live, but whether your requirements comply with the international standards.
>> alter table xyz
>> 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
>>
>Just be careful in which area of the world you are.
>
>There are different system on what the "first" week is:
>http://en.wikipedia.org/wiki/Week#Week_number
Dom