Getting list of dates of DaysOff

Hi everyone,

Can you help me regarding getting the list of dates of dayoff.

StartDate := [11/30/2006];

Enddate := [12/11/2006];

DaysOff := 7;1;

Holidays := [11/30/2006];

@businessday(Startdate;EndDate;DaysOff;Holidays;

ans 7

in x field is get the list of Date of DaysOff:

ans [11/30/2006];[12/02/2006];[12/03/2006];[12/09/2006];[12/10/2006]

Anyone can help?

Thanks

Subject: Getting list of dates of DaysOff

Do you need the number of businessdays between the start and end dates? or do you need the vacation dates between the start & end dates?

For business days number, excluding vacation and weekend days:

@BusinessDays([11/30/2006]; [12/11/2006]; 1 : 7;

[11/30/2006]) gives you “7 days”.

Another way of doing it using variables is:

stdt := “11/30/2006”;

edt := “12/11/2006”;

h := “11/30/2006”;

p := @BusinessDays(@Date(@TextToTime(stdt)); @Date(@TextToTime(edt)); 1 : 7; @Date(@TextToTime(h)));

@Prompt([Ok];“T”; @Text(p)); ------> Gives you “7 business days”

To get the vacation dates list:

@For(n := 1; @Date(@TextToTime(stdt)) <= @Date(@TextToTime(edt)); n := n + 1;

stdt := @If(n = 1; @Text(@Date(@TextToTime(stdt))); @Text(@Adjust(@Date(@TextToTime(stdt)); 0;0; 1; 0;0;0)));

wk := @Text(@Weekday(@TextToTime(stdt)));

@If(@IsMember(stdt; h) | wk = "1" | wk = "7"; tdt := @If(n =1; @Trim(stdt); @Trim(tdt : stdt));""));

@Prompt([Ok];“T”; @Implode(tdt) + " " + @Text(@Elements(tdt)))

-----> Gives you the result containing 5 elements in the vacation days list with dates as 11/30/2006; 12/02/2006; 12/03/2006; 12/09/2006; 12/10/2006

Hope one of these two will be of any help to you.

Subject: RE: Getting list of dates of DaysOff

Hello Narasimha,

Thanks for that, here are the complete scenario.

StartDate :11/30/2006

EndDate: 12/11/2006

Day(s) Off : Saturday,Sunday

No. of Date Off : 4

Dates of Day(s) Off : 12/02/2006; 12/03/2006; 12/09/2006; 12/10/2006

Formula for (No. of Date Off)

DateList := @Explode(@TextToTime(@Text(StartDate) + “-” + @Text(EndDate)));

var1 := @Text(@Weekday(@TextToTime(@Text(DateList))); “G”);

var2 := @Text(SpecifiedDaysOff; “G”);

x1:=@Replace( var1 ; var2 ; “” );

x2:=@Replace(var1 ; x1; “”);

@Elements(@Explode(x2; “;”))

Formula for (Dates of Day(s) Off)

stdt := @Text(StartDate);

edt := @Text(EndDate);

@For(n := 1; @Date(@TextToTime(stdt)) <= @Date(@TextToTime(edt)); n := n + 1;

stdt := @If(n = 1; @Text(@Date(@TextToTime(stdt))); @Text(@Adjust(@Date(@TextToTime(stdt)); 0;0; 1; 0;0;0)));

wk := @Text(@Weekday(@TextToTime(stdt)));

@If(@IsMember(stdt; h) | wk =DayOff; tdt := @If(n =1; @Trim(stdt); @Trim(tdt : stdt));“”));

((tdt))


Thanks again, God Bless Us