Click here to Skip to main content
14,978,008 members
Articles / Programming Languages / SQL
Tip/Trick
Posted 7 Sep 2009

Tagged as

Stats

11.7K views
8 bookmarked

SQL Get the last date of the month

Rate me:
Please Sign up or sign in to vote.
2.60/5 (3 votes)
7 Sep 2009CPOL
Select dateadd(day, -1, dateadd(month, 1, dateadd(day, 1 - day(@Date), @Date))
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)

Share

About the Author

Mycroft Holmes
Retired None
Australia Australia
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.

Comments and Discussions

 
Generalaslamu alaikum , how to get values from database from date 1... Pin
Member 83717645-Dec-11 22:24
MemberMember 83717645-Dec-11 22:24 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.