Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weekdays between Dates

Status
Not open for further replies.

MikeEA

Programmer
Joined
Sep 21, 2001
Messages
5
Location
CA
Hello,
I am a newbie to the Crystal thing, and am trying to come up with a function that will calculate the number of weekdays (Exclude Sat + Sun) between two dates.
Any ideas?

Thanks
Mike

 
There is an example of this between the CR help files. You will need CR8.0 or above to use the DateDiff function

//Crystal syntax
Local DateTimeVar d1 := {Orders.Order Date};
Local DateTimeVar d2 := {Orders.Ship Date};
DateDiff ("d", d1, d2) -
DateDiff ("ww", d1, d2, crSaturday) -
DateDiff ("ww", d1, d2, crSunday)


 
Check out 1b of the FAQ's 'Common formula examples' by Ken Hamady. Although I haven't used that specific formula, I have tried quite a few of his and found them easy to follow and they work!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top