SQL Statement to retrieve date from two weeks ago

  • I am assuming I would use the dateadd function but how would I retrieve the date from two weeks ago from today's date. I basically need to retrieve records from two weeks ago from whatever is today's date.

  • roundel1900 (1/20/2010)


    I am assuming I would use the dateadd function but how would I retrieve the date from two weeks ago from today's date. I basically need to retrieve records from two weeks ago from whatever is today's date.

    Try:select dateadd(ww,-2,getdate())

    Check out BOL for more info on date functions.

    +--------------------------------------------------------------------------------------+
    Check out my blog at https://pianorayk.wordpress.com/

  • Two weeks ago including time, or two weeks ago starting from midnight?

    For example,

    Today = 2010-01-20 08:53:07.907

    2 Weeks ago = 2010-01-06 08:53:07.907

    or

    Today = 2010-01-20 08:53:07.907

    2 Weeks ago = 2010-01-06 00:00:00.000

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

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