GETDATE() - 1 Day

  • How do I subtract 1 day from a date?

    For example, if GETDATE() returns 2004-12-12, how do I make it 2004-12-11?


    Kindest Regards,

  • U can go for this solution:

    declare @temp varchar(20)

    select @temp = GETDATE()

    select DATEADD(day, -1, @temp)

  • Thank you.


    Kindest Regards,

  • Just for the records. Did you try the statement you posted as topic subject?

    select getdate()-1

                                                          

    ------------------------------------------------------

    2004-12-13 10:00:34.750

    (1 row(s) affected)

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

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

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