Our business is open 9-5, Monday to Friday. I am using the SQL function in the attached text file to calculate the elapsed business hours between two datetimes. The variables are as follows:
@startdate - the start datetime of the period (datetime)
@enddate - the end date of the period (datetime)
@starttime - the start of the business day (vchar(9))
@endtime - the end of the business day (vchar(9))
The function is called with a SQL statement that passes the values of these variables to the function.
Does anyone have any idea how I would go about modifying this function to exclude Saturdays and Sundays from the calculation?