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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change 3 Day Holiday Weekend Dates to Next Business Day Date 1

Status
Not open for further replies.

ArizonaRose

Technical User
Oct 22, 2002
2
US
Hello,

I have scoured the internet trying to find this answer, and I can find part, but not all. I am trying to change a 3 day holiday weekend date to the next business day date.

Example: Memorial Day Weekend- I need all 3 dates (05/29/2004, 05/30/2004 & 05/31/2004) to become the first business day 06/01/2004. Everything I do changes Sat & Sun to 05/31/2004 & Mon to 06/01/2004.

This is the code I've been working with: (the holiday array is in the report header)

Code:
WhilePrintingRecords;
Local DateVar FirstDay:= {@DateCreated} ;
DateVar StartDate;
DateVar Array Holidays;

If DayOfWeek(FirstDay) = 7 Then //Saturday
	StartDate :=  FirstDay +2
  Else
If DayOfWeek(FirstDay) = 1 Then
	StartDate := FirstDay + 1  //Sunday
  Else
If StartDate = Holidays then //Holiday
    StartDate := FirstDay +1
  Else
If (DayOfWeek(FirstDay) = 7 and StartDate = Holidays) Then  //Saturday & Holiday
	StartDate := FirstDay + 2  
  Else
If (DayOfWeek(FirstDay) = 1 and StartDate = Holidays) Then  //Sunday & Holiday
	StartDate := FirstDay + 2  
  Else
StartDate:=FirstDay;

Thanks in advance for your help!

Elaine Pope

 
Try using a While loop to test and increment the days accordingly:
[tt]
WhilePrintingRecords;
DateVar Array Holidays;
DateVar StartDate := {@DateCreated};

while (DayOfWeek(StartDate) in [1,7]) or (StartDate in Holidays) do (
StartDate := StartDate + 1);

StartDate;
[/tt]
-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top