• Status: Solved
• Priority: Medium
• Security: Public
• Views: 334

# day of the year - weekends

I used the days360(#1/1/2006#, maximum({InvMovements.EntryDate})) to get the day of the year.  I need a formula or something to exclude weekends. Any ideas?

Thanks for any help.
0
ThomasBallardIT
• 2
1 Solution

Commented:
Hi ThomasBallardIT,
You can get the number of workdays between 2 dayes using the formula here:

Pete
0

Author Commented:
I don't need to deal with holidays, could you simplify that formula a bit.
I'm not much at using variables, but if thats the best way then I will do it.
0

Commented:
I have commented out the lines you don't need.  You can delete them if you wish.
You don't need the Holiday formula at all.

//Main formula
Local DateVar Start := {StartDate};   // place your Starting Date here
Local DateVar End := {EndDate};  // place your Ending Date here
Local NumberVar Weeks;
Local NumberVar Days;
//Local Numbervar Hol;
//DateVar Array Holidays;

Weeks:= (Truncate (End - dayofWeek(End) + 1
- (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0)  +
(if DayOfWeek(End) = 7 then -1 else 0);

//Local NumberVar i;
//For i := 1 to Count (Holidays)
//do (if DayOfWeek ( Holidays[i] ) in 2 to 6 and
//    Holidays[i] in start to end then Hol:=Hol+1 );

Weeks + Days
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.