I need to find out hwo to calculate the number of hours between to dates and their times, but i must be able to remove weekends. For instance a job started on Sunday cannot be considered to be a core in my total hours. I needa way to separate the weekends OUT.
' Coded not TESTED
Dim dtStart, dtOutDate, noBusinessDays
dtStart=Date 'get system date
dtOutDate=Request.Form("your_input_date")
noBusinessDays=datediff(d, dtStart, dtOutDate)-(datediff(ww, dtStart, dtOutDate)*2)
'calculate hours as needed
'Number of days excluding..
' The +1 because you are including the first day.
' For example 21st - 21st = 1day
WorkingDays: IIf(Weekday(StartDate) > Weekday(EndDate),1+Int((EndDate-StartDate)/7),Int((EndDate-StartDate)/7))*5 + Weekday(EndDate) - Weekday(StartDate) +1
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.