-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
>I would appreciate if some one can tell me whether there is any direct command
>to get week number(1 to 52) for a given date in DB2.
It's not pretty, but...
select (days(YourDateValue) -
days(date(char(char(year(YourDateValue)),4) || '001')) + 7) / 7
from YourTable
...will give you values in the range of 1 to 53 (inclusive). This
approach assumes that week 1 consists of Jan 1 through Jan 7
(inclusive) and that you are not concerned if the year started on a
day other than Sunday.
If you are
concerned...(scribble...scribble...scratch...erase...scribble...
scratch...scribble...erase...)...you shouldn't be. :)
94 KTM 620EXC (Gomer)
96 KX80 (Danny)
97 KX60 (Ricky)
96 50SXR (Ricky)
Thanks to: KORE SportCycles 888-394-KORE, the Carolinas' newest KTM dealer
>94 KTM 620EXC (Gomer)
>96 KX80 (Danny)
>97 KX60 (Ricky)
>96 50SXR (Ricky)
>Thanks to: KORE SportCycles 888-394-KORE, the Carolinas' newest KTM dealer
Oops! Sorry, I just realized I was leaving my "normal" sig on from
when I usually post to a motocross related newsgroup. I promise to
clean up my act. :)
Michael Nyland
mny...@mindspring.com
In DB2 common server and UDB you can use the week function.
From the clp or script center/command center try something like
"values week('1998-01-31')"
Hope this helps,
Gert
dhina...@msn.com wrote:
>
> Hi,
> I would appreciate if some one can tell me whether there is any direct command
> to get week number(1 to 52) for a given date in DB2.
mfg
Karl