SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Finding first/last day of month by a date

By Benny.Tordrup,

This script finds the first day of previous, current and next month as well as last day of previous, current and next month.

The calculation is based on the ISO date format which makes it independant of the date format used on the SQL Server.

The calculation is performed from a date - it can be altered to use a year/month combination

Total article views: 207 | Views in the last 30 days: 1
Related Articles

Month Name

Function to return the Month Name for month number input


convert month name to month number

convert month name to month number



Month/Year format through TSQL


Financial Month

This Script will return the respective financial month(Starts from April to March) for a calander mo...


Display Month wise data

Dynamic month column