Click here to Skip to main content
12,693,094 members (32,363 online)
Click here to Skip to main content
Articles » Database » Database » General » Alternatives
Alternatives (2)
Add your own
alternative version

Tagged as

Stats

8.7K views
8 bookmarked
Posted

SQL Get the last date of the month

, 7 Sep 2009 CPOL
Select dateadd(day, -1, dateadd(month, 1, dateadd(day, 1 - day(@Date), @Date))

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

18 Nov 2009
Asif Mushtaq
declare @Date datetimeset @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)

Share

About the Author

Mycroft Holmes
Software Developer (Senior) Contractor
Singapore Singapore
Started my programming life writing Excel 1.0 macros, God what a long time ago.

Now I'm a dotnet developer, I get to influence direction, play with new toys, build stuff, life is wonderful.

Greatest buzz you can get, walk past a row of desks and see your application running on all of them (and getting paid).

Greatest irritant, pouring 12 months of knowledge and experience into an empty head only to have it leave.

Pro
Pro
| | Privacy | Terms of Use | Mobile
Web02 | 2.8.170118.1 | Last Updated 8 Sep 2009
Article Copyright 2009 by Mycroft Holmes
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid