The C# Code I have used,
DateTime _dtFYS = new DateTime(_lab.fys.Year, _lab.fys.Month, _lab.fys.Day, 0, 0, 1);
DateTime _dtFYE = new DateTime(_lab.fye.Year, _lab.fye.Month, _lab.fye.Day, 23, 59, 59);
cmdp.Parameters.AddWithValue("@fys", _dtFYS.ToString("yyyy-MM-dd hh:mm:ss tt"));
cmdp.Parameters.AddWithValue("@fye", _dtFYE.ToString("yyyy-MM-dd hh:mm:ss tt"));
So in this above code the selected date from jquery datepicker will be passed and when i debug it in local system it works fine,once i deploy it in server the problem arises as error converting datetime to nvarchar.
I tried using Logger and in that the value is passing as 01/01/0001..
The problematic part is when you are trying to format the value like so : _dtFYS.ToString("yyyy-MM-dd hh:mm:ss tt")
Dont apply this format, just pass it as a normal string or datetime. Database will store it in binary form and then you can display the value when you retrieve it with the format you are applying to it.