How to Get the Previous Month in T-SQL Database: MS SQL Server Operators: CURRENT_TIMESTAMP DATEADD() MONTH() Table of Contents Problem: Solution: Discussion: Problem: You would like to display the previous month (without time) in a SQL Server database. Solution: SELECT MONTH(DATEADD(MONTH, -1, CURRENT_TIMESTAMP)); Discussion: To get the previous month in SQL Server, subtract one month from today's date and then extract the month from the date. First, use CURRENT_TIMESTAMP to get today's date. Then, subtract 1 month from the current date using the DATEADD function: use MONTH as the date part with -1 as the parameter. Finally, extract the month from the received date using the MONTH() function. Recommended courses: SQL Basics in SQL Server Common Functions in SQL Server Recommended articles: SQL Server Cheat Sheet Top 29 SQL Server Interview Questions How to Learn T-SQL Querying How to Get the First Day of the Week in SQL Server SQL Date and Time Functions in 5 Popular SQL Dialects See also: How to Add Days to a Date in T-SQL How to Calculate the Difference Between Two Dates in T-SQL How to Get the Month from a Date in T-SQL How to Get the Year from a Date in T-SQL How to Get Yesterday’s Date in T-SQL Subscribe to our newsletter Join our monthly newsletter to be notified about the latest posts. Email address How Do You Write a SELECT Statement in SQL? What Is a Foreign Key in SQL? Enumerate and Explain All the Basic Elements of an SQL Query