Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding startdate and enddate if week number and year is given 1

Status
Not open for further replies.

swetham

Programmer
May 5, 2010
257
DE
Hi,
Can anyone tell me the formula to find startdate and enddate if week number and year is given. I want the week numbers according to the ISO format ie, for 2010 week 1=jan 4 to 10. Week starts from Monday, week 53=dec27 2009 to jan 3 2010.


Thanks,
Sweish.
 
So you are saying your weeks run Monday to Sunday?

In Crystal you have to define the first week of year rule--in your case it appears to be either the "First Four Days" (first week in the year containing at least four days) or "First Full Week". Which is it?

-LB
 
I need it for first full week ie, for week 53 i should get 2009/12/27 to 2010/01/03
 
can anyone assist me in this issue? It is very urgent.
 
There is no week 53 in 2009 if you are using FirstFullWeek to define the first week of the year. You are also showing a week that runs from Sunday 12/27/09 to Sunday 1/3/10. You need to clarify what you are looking for.

-LB
 
I want 2010 week 1 means it should show 2010-01-04 to 2010-01-10. i dont know whether i was able to explain it clearly or not.
 
That isn't really sufficient--as I said earlier, that could be either firstfourdays or firstfullweek. Do you know what week one in 2009 would be? You want this to work whatever the year.

-LB
 
numbervar wk := {?WeekNo};
numbervar yr := {?Year};
datevar wk1dt; //firstfullweek;
if dayofweek(date(yr,1,1),crMonday) = 1 then
wk1dt := date(yr,1,1) else
wk1dt := date(dateadd("ww",1, date(yr,1,1)-dayofweek(date(yr,1,1),crMonday)+1));
datevar wkstart := date(dateadd("ww",wk-1,wk1dt));

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top