Click here to Skip to main content
Click here to Skip to main content

SQL Get the last date of the month

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

License

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

About the Author

Mycroft Holmes
Software Developer (Senior) Contractor
Singapore Singapore
Member
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.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Generalaslamu alaikum , how to get values from database from date 1...memberMember 83717645 Dec '11 - 22:24 
aslamu alaikum , how to get values from database from date 1st to 30th

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 8 Sep 2009
Article Copyright 2009 by Mycroft Holmes
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid