MySQL MINUTE() Function
The MINUTE()
function in MySQL extracts the minute from a time or datetime value. This is a very useful function for working with time data, and for performing time-based analysis or filtering.
MINUTE(): Definition and Usage
MINUTE()
is helpful when you need to focus on the minute component of a time or datetime value. You might use it to analyze events based on their minute, create detailed time logs, or filter data based on particular minute intervals. The function always returns an integer between 0 and 59 (inclusive).
Syntax
Syntax
MINUTE(datetime)
Parameter Values
Parameter | Description |
---|---|
datetime |
The time or datetime value. This is required. |
Examples
Extracting Minutes from a DATETIME Value
This example extracts the minute (34) from the datetime value "2017-06-20 09:34:00".
Syntax
SELECT MINUTE("2017-06-20 09:34:00");
Output
34
Extracting Minutes from a TIME Value
This example shows how to extract the minute component from a time value.
Syntax
SELECT MINUTE("23:59:59");
Output
59