Handling date in SQL Server

Don’t pass dates as strings. Pass them as DateTime.
The .Net DateTime maps directly to SQL Server’s DateTime. All you have to do is parse the string to a DateTime struct in your .Net code and pass it as a parameter to your stored procedure.
To search for a specific date and ignore the Time portion of the DateTime, better use >= and < in your sql:

select * 
from table 
where acceptedDate >= @Date
AND acceptedDate < DATEADD(DAY, 1, @Date);

Leave a Comment