I have a parameter string that passes date value to a stored proc
cmdItemSearch.Parameters.Add(new SqlParameter("@EndDate", SqlDbType.DateTime));
cmdItemSearch.Parameters["@EndDate"].Value = Convert.ToDateTime(DateTime.Now);
The value being passed is “6/30/2010 7:45:00 AM”
I want to pass only “6/30/2010”
How would I do that?
For starters,
DateTime.Nowis already aDateTimeso doesn’t need to be converted as you have.Secondly, you can obtain just the date of Today by using
DateTime.Todayinstead ofDateTime.Now.However, if your date isn’t “today” then you can just use
yourDateTime.Dateto return just the Date.