The MySQL MINUTE()
function is used to return the minute component from a time value.
The return value for this function is in the range 0 to 59. Below are examples to demonstrate.
Syntax
The syntax of this function goes like this:
MINUTE(time)
Where time
is the time value that you want to extract the minutes component from.
Example 1 – Basic Usage
Here’s an example to demonstrate.
SELECT MINUTE('10:35:27');
Result:
+--------------------+ | MINUTE('10:35:27') | +--------------------+ | 35 | +--------------------+
Example 2 – Abbreviated Time Value
Here’s an example using an abbreviated time value, where only the hour and minutes are provided in the argument.
SELECT MINUTE('10:35');
Result:
+-----------------+ | MINUTE('10:35') | +-----------------+ | 35 | +-----------------+
However, be careful when using abbreviated time values, as MySQL can sometimes interpret them differently to what you might expect.
Here’s what the MySQL documentation says about this:
Be careful about assigning abbreviated values to aÂ
TIME
 column. MySQL interprets abbreviatedTIME
 values with colons as time of the day. That is,Â'11:12'
 meansÂ'11:12:00'
, notÂ'00:11:12'
. MySQL interprets abbreviated values without colons using the assumption that the two rightmost digits represent seconds (that is, as elapsed time rather than as time of day). For example, you might think ofÂ'1112'
 andÂ1112
 as meaningÂ'11:12:00'
 (12 minutes after 11 o’clock), but MySQL interprets them asÂ'00:11:12'
 (11 minutes, 12 seconds). Similarly,Â'12'
 andÂ12
 are interpreted asÂ'00:00:12'
.
Example 3 – An Alternative
You can also use the EXTRACT()
function to extract the minutes (and other date/time parts) from a date/time value:
SELECT EXTRACT(MINUTE FROM '10:35:27');
Result:
+---------------------------------+ | EXTRACT(MINUTE FROM '10:35:27') | +---------------------------------+ | 35 | +---------------------------------+