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, 1054🔥, 0💬
Popular Posts:
How To Generate Random Numbers with the RAND() Function in SQL Server Transact-SQL? Random numbers a...
How to put statements into a statement block in SQL Server Transact-SQL? You can put statements into...
How to set the current database in SQL Server? Once you are connected to the SQL Server, you should ...
How To List All Stored Procedures in the Current Database in SQL Server Transact-SQL? If you want to...
How To Calculate Age in Days, Hours and Minutes in SQL Server Transact-SQL? On many Web sites, news ...