Re: Last day of the month

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Dave F (dave_at_nospam.com)
Date: 07/14/04


Date: Wed, 14 Jul 2004 13:10:40 -0700

Whoa! What helpful info!

To paraphrase Dr. Nick: Thanks Everybody!

"Dave F" <dave@nospam.com> wrote in message
news:Oq$NFXdaEHA.2792@TK2MSFTNGP09.phx.gbl...
> Is there an easy way to get the last day of the month using T-SQL date
time
> functions?
>
> THis will get me the first of the month:
>
> SELECT @EndDate= CAST(DATEPART(mm, GETDATE()) as varchar(2)) + '/1/' +
> CAST(DATEPART(yyyy, GETDATE()) as varchar(4))
>
> But to get the end of the month I think I have to use CASE and account for
> both the month and a leap year. Before I try this, can someone tell me if
> there is a simplier approach?
>
>
>