Toad World® Forums

How can I calculate the number of business days between two dates

Hi,

In one of my TDP Reports I need to display the number of working business days between two known days (last calendar month).

I need to count days [Mon. Tue, Wed, Thur, Fri] and don’t need to know about bank holidays etc…

Can this be done with a calculated field in the Report Designer?

Thank you in advance.

Regards

David

I tried to use a calculated feild in the Report designer with

DATEDIFF(datepart,startdate,enddate).
Having datepart set to dw, but I couldn’t get it to work.

So I amended my SQL statement to include the following and that works for me

SELECT COUNT (DISTINCT PLTC.[Date Logged]) AS WorkingDays
FROM DOVICO.dbo.PLTC PLTC
WHERE ( (PLTC.[Date Logged] = calendar__gregorian__last_month__)
AND ( DATENAME (dw, PLTC.[Date Logged]) <> ‘Saturday’
AND DATENAME (dw, PLTC.[Date Logged]) <> ‘Sunday’))

Message was edited by: djenkinson