[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Weekday Calculation

Posted on 2007-03-26
2
Medium Priority
?
1,884 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 500 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

873 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