Collections:
MONTH() - Month of Year
How to extract the month of year from a given date using the MONTH() function?
✍: FYIcenter.com
MONTH(date) is a MySQL built-in function that
returns the month of year from a given date.
For example:
SELECT MONTH('2023-02-03'), MONTH(NOW()), NOW();
-- +---------------------+--------------+---------------------+
-- | MONTH('2023-02-03') | MONTH(NOW()) | NOW() |
-- +---------------------+--------------+---------------------+
-- | 2 | 11 | 2023-11-15 08:19:34 |
-- +---------------------+--------------+---------------------+
Reference information of the MONTH() function:
MONTH(date): int Returns the month for date, in the range 1 to 12 for January to December, or 0 for dates such as '0000-00-00' or '2008-00-00' that have a zero month part. Arguments, return value and availability: date: Required. The date to extract the month of year from. int: Return value. The month of year. Available since MySQL 4.
Related MySQL functions:
2023-11-17, 1133🔥, 0💬
Popular Posts:
How to put statements into a statement block in SQL Server Transact-SQL? You can put statements into...
How To Connect to a MySQL Server with a Port Number in MySQL? If you want to connect a MySQL server ...
How To Insert New Line Characters into Strings in SQL Server Transact-SQL? If you want to break a st...
Where to find answers to frequently asked questions on Conditional Statements and Loops in SQL Serve...
What Are Date and Time Functions in MySQL? MySQL offers a number of functions for date and time valu...