You're passing a string as a DateTime parameter. The following should work:
[WebMethod()]
public double GetDayCount(string strMeetingDate, string strMeetingTime)
{
string[] strStartDateParts = strMeetingDate.Split('-');
// not sure what your expected time format is
string[] srtStartTimeParts = strMeetingTime.Split('-');
int year = Int32.Parse(strStartDateParts[2]);
int month = Int32.Parse(strStartDateParts[1]);
int day = Int32.Parse(strStartDateParts[0]);
int hour = Int32.Parse(srtStartTimeParts[0]);
int min = Int32.Parse(srtStartTimeParts[1]);
int sec = Int32.Parse(srtStartTimeParts[2]);
DateTime meetingDate = new DateTime(year, month, day, hour, min, sec);
using (connection = new SqlConnection(ConfigurationManager.AppSettings["connString"]))
{
using (command = new SqlCommand("BusinessHours", connection))
{
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@meeting_date", SqlDbType.DateTime).Value = meetingDate;
connection.Open();
using (reader = command.ExecuteReader())
{
reader.Read();
return (double)reader["hours"];
}
}
}
}
Then change your sproc to parse out the date and time from your argument:
ALTER PROCEDURE [dbo].[BusinessHours]
@meeting_date DATETIME
AS
DECLARE @meeting_day DATETIME
DECLARE @meeting_time DATETIME
DECLARE @submit_day DATETIME;
DECLARE @submit_time DATETIME;
DECLARE @start_time_of_business_day DATETIME;
DECLARE @business_day_hours FLOAT;
DECLARE @num1 FLOAT
DECLARE @num2 FLOAT
DECLARE @num3 FLOAT
SET @meeting_day = CONVERT(VARCHAR(10),@meeting_date,101);
SET @meeting_time = CONVERT(VARCHAR(8),@meeting_date,108);
SET @submit_day = CONVERT(VARCHAR(10),GETDATE(),101);
SET @submit_time = CONVERT(VARCHAR(8),GETDATE(),108);
SET @start_time_of_business_day = '09:00';
SET @business_day_hours = 8.5;
SET @num1 = ((DATEDIFF(dd, @submit_day, @meeting_day))
-(DATEDIFF(wk, @submit_day, @meeting_day) * 2)
-(CASE WHEN DATEPART(dw, @submit_day) = 1 THEN 1 ELSE 0 END)
-(CASE WHEN DATEPART(dw, @meeting_day) = 7 THEN 1 ELSE 0 END)
-(SELECT COUNT(*) FROM bank_holiday WHERE the_date BETWEEN @submit_day AND @meeting_day)) * @business_day_hours
SET @num2 = (select datediff(minute, @start_time_of_business_day, @submit_time)) / 60.0
SET @num3 = (select datediff(minute, @start_time_of_business_day, @meeting_time)) / 60.0
select @num1 - @num2 + @num3 as [hours]