Open In App

MINUTE(), MICROSECOND() and HOUR() functions in MySQL

Improve
Improve
Like Article
Like
Save
Share
Report

1. MINUTE() : 
The MySQL MINUTE() function is used for return the minute part of a datetime value. It can be between 0 to 59.When the datetime is passed in MINUTE() function then it will return the minute value . 

Syntax – 

MINUTE(datetime) 

Parameter – 
It take parameter a dateline value. 

Return – 
It returns a minute numeric value between 0 to 59. 

Example-1:  

SELECT MINUTE ("2020-06-29 10:34:00"); 

Output –  

34

Example-2:  

SELECT MINUTE("4:10:17");

Output –  

10

2. MICROSECOND() – 
The Mysql function MICROSECOND() is used for return the microsecond part of datetime value .It can be between 0 to 999999.When the datetime is passed in MINUTE() function then it will return the microsecond value . 

Syntax [-  

MICROSECOND(datetime)

Parameter – 
A datetime value. 

Return – 
Return an integer 

Example-1:  

SELECT MICROSECOND("2010-07-20 06:24:10.967423"); 

Output –  

967423

Example-2:  

SELECT MICROSECOND("2005-10-10 12:24:17.000007"); 

Output –  

7

3. HOUR() : 
The MySQL function HOUR() returns the hour part of a given datetime. It can be between 0 to 838. 

Syntax –  

HOUR(datetime) 

Parameter – 
A datetime value. 

Return – 
It return an integer value. 

Example-1:  

SELECT HOUR("12:24:17.000007"); 

Output –  

12

Example-2:  

SELECT MICROSECOND(""838:59:59""); 

Output –  

838

Supported Versions of MySQL :  

  • MySQL 4.0
  • MySQL 4.1
  • MySQL 5.0
  • MySQL 5.1
  • MySQL 5.5
  • MySQL 5.6
  • MySQL 5.7 

Last Updated : 09 Dec, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads