datetime datatype

  • hi guys, can any help with the below sql

    select getdate()

    returns 2009-05-28 11:18:49.123 as datetime datatype

    is there a way i can format the getdate()

    to return as 2009-05-28 00:00:00.000 datetime datatype

  • SELECT DATEADD (DAY, DATEDIFF (DAY, 0, '2009-05-28 11:18:49.123'), 0)

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • many thanks

  • Frank Kalis (5/28/2009)


    SELECT DATEADD (DAY, DATEDIFF (DAY, 0, '2009-05-28 11:18:49.123'), 0)

    Might be a little more usful if it returned tomorrow's date if it is run tomorrow:

    SELECT DATEADD (DAY, DATEDIFF (DAY, 0, getdate()), 0)

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply