Solved

day of the year - weekends

Posted on 2006-11-14
3
319 Views
Last Modified: 2008-03-10
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
Comment
Question by:ThomasBallardIT
  • 2
3 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 17938862
Hi ThomasBallardIT,
You can get the number of workdays between 2 dayes using the formula here:
http://kenhamady.com/form01.shtml

Pete
0
 
LVL 3

Author Comment

by:ThomasBallardIT
ID: 17939284
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
 
LVL 77

Accepted Solution

by:
peter57r earned 250 total points
ID: 17939388
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
WhileReadingRecords;
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now