Hi all,
I need a 'select' query that can give me the date of the first 'Monday' in a
month for any given month, but am not sure how to go about this.
Say I want to know the date of the first Monday in June ?
regards,
Colin H.SELECT DATEADD(wk,
DATEDIFF(wk,0,DATEADD(dd,6-DATEPART(DAY,GETDATE()),GETDATE())), 0)
"Colin H" <ssssss@.koko.com> wrote in message
news:d02i9n$suh$1@.titan.btinternet.com...
> Hi all,
> I need a 'select' query that can give me the date of the first 'Monday' in
a
> month for any given month, but am not sure how to go about this.
> Say I want to know the date of the first Monday in June ?
> regards,
> Colin H.
>
>|||http://www.aspfaq.com/2519
http://www.aspfaq.com/
(Reverse address to reply.)
"Colin H" <ssssss@.koko.com> wrote in message
news:d02i9n$suh$1@.titan.btinternet.com...
> Hi all,
> I need a 'select' query that can give me the date of the first 'Monday' in
a
> month for any given month, but am not sure how to go about this.
> Say I want to know the date of the first Monday in June ?
> regards,
> Colin H.
>
>|||Thanks for the help. That works a treat.
Colin H.|||That seems like a lot of work just to get the first monday of a given month.
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:O7gDA0pHFHA.2936@.TK2MSFTNGP15.phx.gbl...
> http://www.aspfaq.com/2519
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Colin H" <ssssss@.koko.com> wrote in message
> news:d02i9n$suh$1@.titan.btinternet.com...
in
> a
>|||> That seems like a lot of work just to get the first monday of a given
month.
Maybe, but the table really has a small footprint, and I guess if you have
an application that is used only to get the first monday of a given month,
you're probably right. However there are dozens of other uses as well.
A|||Very true, I actually created the table locally and populated it based on
that article, it's a neat design - I'm not knocking that. I like it
actually. Just seemed like overkill for the question. But I can see many
uses for the article you posted.
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:%23xy3zDqHFHA.236@.TK2MSFTNGP14.phx.gbl...
> month.
> Maybe, but the table really has a small footprint, and I guess if you have
> an application that is used only to get the first monday of a given month,
> you're probably right. However there are dozens of other uses as well.
> A
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment