Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# Weekday Calculation

Posted on 2007-03-26
Medium Priority
1,883 Views
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
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

LVL 28

Accepted Solution

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:

0

Author Comment

ID: 18793474
It works great.  Thanks.
0

## Featured Post

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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
###### Suggested Courses
Course of the Month11 days, 3 hours left to enroll