?
Solved

Weekday Calculation

Posted on 2007-03-26
2
Medium Priority
?
1,882 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

764 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