Solved

Weekday Calculation

Posted on 2007-03-26
2
1,880 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 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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. …
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

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