Solved

Weekday Calculation

Posted on 2007-03-26
2
1,878 Views
Last Modified: 2012-05-05
Crystal Reports 9:

I got this formula that is supposed to calculate the weekdays in the month and it supposed to not include saturday and sunday.  This is what I have.

Local DateTimeVar d1 :=  PrintDate;
d1 := DateSerial(Year(d1), Month(d1), 1);

Local DateTimeVar d2 :=  PrintDate;
d2 := DateSerial(Year(d2), Month(d2)+1, 0);

DateDiff ("d", d1, d2) -
     DateDiff ("ww", d1, d2, crSaturday) -
     DateDiff ("ww", d1, d2, crSunday)
 
It comes up to: 21
but it is supposed to be 22.  Can anyone help me to find out what is going on?

0
Comment
Question by:vbjohn
2 Comments
 
LVL 28

Accepted Solution

by:
bdreed35 earned 125 total points
ID: 18793423
Take a look at this link, which gives the best example of WorkDay counting that I kow of:

http://www.kenhamady.com/form01.shtml
0
 

Author Comment

by:vbjohn
ID: 18793474
It works great.  Thanks.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

740 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