How to Get the Month from a Date in MySQL Database: MySQL Operators: MONTH() Table of Contents Problem Example Solution Discussion Problem You’d like to get the month from a date/datetime column in a MySQL database. Example Our database has a table named apartment_rental with data in the columns id, address, floor, and start_date. idaddressfloorstart_date 1700 Oak Street22019-03-20 2295 Main Street32019-05-31 3506 State Road12019-01-03 43949 Route 3112019-02-01 For each available apartment, get the address, the floor, and the month when it’s available. Get only the month from the start_date column. Solution We’ll use the MONTH() function. Here’s the query you’d write: SELECT address, floor, MONTH(start_date) AS start_month FROM apartment_rental; Here’s the result of the query: addressfloorstart_month 700 Oak Street23 295 Main Street35 506 State Road11 3949 Route 3112 Discussion Use the MONTH() function to retrieve a month from a date/datetime/timestamp column in MySQL. This function takes only one argument – either an expression which returns a date/datetime/ timestamp value or the name of a date/datetime/timestamp column. (In our example, we use the start_date column of date data type). MONTH() returns the month as an integer from 1 to 12 (1 is January and 12 is December). In our example, the apartment at 700 Oak Street will start renting in month 3 because its start date is 2019-03-20. Recommended courses: SQL Basics in MySQL Common MySQL Functions SQL Practice Set in MySQL Recommended articles: MySQL Cheat Sheet 18 Useful Important SQL Functions to Learn ASAP Performing Calculations on Date- and Time-Related Values MySQL Date Functions: Complete Analyst’s Guide See also: How to Group by Month in MySQL How to Get the Year from a Datetime Column in MySQL How to Get the Year and the Month From a Date in MySQL How to Get the Date from a Datetime Column in MySQL How to Add Time to a Datetime Value in MySQL 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