Click here to Skip to main content
15,886,199 members
Articles / Programming Languages / SQL
Alternative
Tip/Trick

SQL Get the last date of the month

Rate me:
Please Sign up or sign in to vote.
3.78/5 (5 votes)
17 Nov 2009CPOL 22.4K   5  
An alternative version of "SQL Get the last date of the month"
SQL
declare @Date datetime
set @Date = '2009/10/17'
Select dateadd(day, 0 - day(dateadd(month, 1 , @Date)), dateadd(month, 1 , @Date))

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Pakistan Pakistan
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --