Number of days

deejay_totoro

Registered User.
Local time
Today, 14:14
Joined
May 29, 2003
Messages
169
Hello,

I am trying to calculate the number of days within a certain period on a report.

However, the number of days must not count Saturdays or Sundays.

I can calulate the number of days using: [EndDate]-[StartDate]. But how can I take Saturdays and Sundays out of this calucation?

How might I start to work this one out?

Thanks!

dj_T
 
Check out the DateDiff function by doing a search on here.
In one of my db's I have a module with the following code which I can then call in any form or report - saves time if you need it in a lot of reports. HTH

Public Function GetWorkingDays(StartDate As Date, EndDate As Date) As Integer

Dim Days As Integer
Dim WorkingDays As Integer
Days = datediff("d", StartDate, EndDate)
WorkingDays = Days - datediff("ww", StartDate, EndDate, 1) - datediff("ww", StartDate, EndDate, 7) + 1

GetWorkingDays = WorkingDays

End Function
 
Seeing that Mile-O's code encompasses bank holidays, ignore mine.
ps, thanks Mile - looks very useful.
 

Users who are viewing this thread

Back
Top Bottom