• mbova407 (9/1/2010)


    This is how we get the date for the current day without time element

    DECLARE @a INT

    DECLARE @b-2 DATETIME

    set @b-2 = GETDATE()-.5

    SET @a = CONVERT(INT,@b)

    SELECT CONVERT(DATETIME, @a), @b-2

    the -.5 is half a day because CONVERT(INT,@b) rounds

    If I run the code above I get:

    (No column name) | (No column name)

    2010-09-01 00:00:00.000 | 2010-08-31 20:54:59.743

    Looks like the time is still there but just 0.

    Here's another way to get the current date without the time:

    Select CONVERT(varChar(10), getDate(), 101);

    This returns: 09/01/2010