How to get the start date of the Week

  • Lynn Pettis (5/27/2009)


    select dateadd(wk, datediff(wk, 0, dateadd(dd, -1, @ThisDate)), 0);

    Nice one...

    As simple as efficient. 🙂

    Thanxalot, Lynn.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • lmu92 (5/27/2009)


    Lynn Pettis (5/27/2009)


    select dateadd(wk, datediff(wk, 0, dateadd(dd, -1, @ThisDate)), 0);

    Nice one...

    As simple as efficient. 🙂

    Thanxalot, Lynn.

    Curious, where in Germany. My daughter is over there for a week. I think she landed in Frankfurt (sp??).

  • @vkoka

    would this solution help (based on one of Lynn's date routines)?

    declare @wk int

    set @wk =22

    select dateadd(wk, datediff(wk, 0, dateadd(dd,(@wk-1)*7,'20090101')), 0)

    /* result

    2009-05-25 00:00:00.000

    */



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 3 posts - 16 through 17 (of 17 total)

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