MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Week number of a year according to MS outllook calendar

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
showkath
Beginner


Joined: 23 Mar 2005
Posts: 17
Topics: 7

PostPosted: Wed May 04, 2005 5:51 am    Post subject: Week number of a year according to MS outllook calendar Reply with quote

Hi all,

Can anyone help me to solve the following:

I want to find out the week number for the given date as per
MS outlook Calendar calculation in DB2.

For example,

1) if date is 01-jan-2005, then week number is 52
since that week spreads across the years 2004 and 2005.
i.e the date falls on other days other than sunday then
1st jan corresponds to last week of the previous year

2) if date is 01-jan-2006, the week number is 01. i.e the date falls of
sunday means than that week corrsponds to current year

Thanks in advance.
_________________
Regards,
Showkath
-----------------------------------------------------
Our opinions do not really blossom into fruition until we have expressed them to someone else - Mark Twain
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed May 04, 2005 7:34 am    Post subject: Reply with quote

Showkath,

Check the scalar function week which will give you the desired results.The WEEK function returns an integer in the range of 1 to 54 that represents the week of the year. The week starts with Sunday.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQH11/3.2.93?SHELF=&DT=20010718164132&CASE=

Also check this link for WEEK_ISO function which returns an integer in the range of 1 to 53 that represents the week of the year. The week starts with Monday

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQH11/3.2.94?SHELF=&DT=20010718164132&CASE=

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
showkath
Beginner


Joined: 23 Mar 2005
Posts: 17
Topics: 7

PostPosted: Wed May 04, 2005 10:26 pm    Post subject: Reply with quote

Dear Kolusu,

Thanks in bunch.

Regards,
Showkath
_________________
Regards,
Showkath
-----------------------------------------------------
Our opinions do not really blossom into fruition until we have expressed them to someone else - Mark Twain
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group