• lhowe (4/7/2010)


    Another method to strip the time from a date/time value and keep it as a datetime type would be: CONVERT(datetime,CONVERT(varchar,GetDate(),101))

    This is probably the best generic method for rounding datetime - by using varchar(N) for vaious values of N and with different type arguments instead of 101 it can round down to second, minute, hour, month, or yearas well as to day. Of course it uses more CPU than the method in the article, and that will be important sometimes.

    Tom