How to Get the Month from a Date in T-SQL Database: MS SQL Server Operators: MONTH() Table of Contents Problem: Example: Solution: Discussion: Problem: You’d like to get the month from a date field in a SQL Server database. Example: Our database has a table named Furniture with data in the columns Id, Name, and ProducedDate. IdNameProducedDate 1sofa2018-01-10 2chair2018-01-05 3desk2018-06-20 4bookcase2018-11-15 Let’s get the month from each product’s ProducedDate and find out which furniture was produced in a given month. Solution: We’ll use the MONTH() function. Here’s the query you would write: SELECT Name, MONTH(ProducedDate) AS ProducedMonth FROM Furniture; Here’s the result of the query: NameProducedMonth sofa1 chair1 desk6 bookcase11 Discussion: To get a month from a date field in SQL Server, use the MONTH() function. This function takes only one argument – the date. This can be a date or date and time data type. (In our example, the column ProducedDate is of the date data type.) The argument can be a column name or an expression. (In our example, it is the ProducedDate column). MONTH() returns the month number as an integer from 1 to 12. For the desk item, the ProducedMonth value is 6 (returned from the 'YYYY-MM-DD' date '2018-06-20'). 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 5 SQL Functions for Manipulating Strings 18 Useful Important SQL Functions to Learn ASAP Performing Calculations on Date- and Time-Related Values See also: How to Remove Leading and Trailing Spaces in T-SQL How to Get the Year from a 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