If we want to remove time part from the date without converting the date to varchar.
Example:
SELECT GETDATE() gives the Current Date.
i.e, 2012-01-26 23:38:21.983
Now f I want only the date part i.e, 2012-01-26 00:00:00.000.
But I don't want to convert it to varchar.
Below is the code.
SELECT DATEADD(DAY,DATEDIFF(DAY,0,GETDATE()),0)
Output:
2012-01-26 00:00:00.000
Example:
SELECT GETDATE() gives the Current Date.
i.e, 2012-01-26 23:38:21.983
Now f I want only the date part i.e, 2012-01-26 00:00:00.000.
But I don't want to convert it to varchar.
Below is the code.
SELECT DATEADD(DAY,DATEDIFF(DAY,0,GETDATE()),0)
Output:
2012-01-26 00:00:00.000