I know there are several posts about stripping the time portion from a datetime column. And everyone suggests that the DATEADD and DATEDIFF method is the best for performance and individuals should not adopt the process of cast/converting date values to varchar. So I was wanting to utilize the functions below but I don't understand why the result I receive still has the time value associated to it though the time is all zeroes?
To provide more information as to why I want to understand this result. I have a stored procedure that I wish to specify the following:
DECLARE @DateShippedBegin DATETIME DECLARE @DateShippedEnd DATETIME SET @DateShippedBegin = dateadd(dd, datediff(dd, 0, @DateShipped), 0) SET @DateShippedEnd = dateadd(dd, datediff(dd, 0, @DateShipped) + 1, 0) WHERE O.date_shipped >= @DateShippedBegin and O.date_shipped < @DateShippedEnd
But when I execute the procedure with a basic date format I receive no results so trying to understand the best concept to adopt for my procedure.
Select DATEADD(dd, DATEDIFF(dd, 0, Getdate()), 0) from orders where order_no = '1247401'
Example of begginning date value:
Example of query result: