MAKETIME() Function in MySQL
Last Updated :
27 Nov, 2020
MAKETIME() function :
This function in MySQL is used to create and return a time value based on specified hour, minute, and second value. In MySQL’s TIME value limit is 838:59:59.
Syntax :
MAKETIME(hour, minute, second)
Parameters :
This method accepts three parameters as given below –
- hour : Specified hours value
- minute : Specified minutes value
- second : Specified seconds value
Returns :
It returns a time value based on a specified hour, minute, and second value.
Example-1 :
Getting a time “09:03:12” from specified 9 hours, 3 minutes and 12 seconds.
SELECT MAKETIME(9, 3, 12);
Output :
09:03:12
Example-2 :
Getting a time “838:54:59” from specified 838 hours, 54 minutes and 59 seconds.
SELECT MAKETIME(838, 54, 59);
Output :
838:54:59
Example-3 :
Getting a time “838:59:59” from specified 839 hours, 12 minutes, and 9 seconds. Here hours are taken as 839 which is greater than the hour limit of 838, so returned time is up to its limit of “838:59:59”.
SELECT MAKETIME(839, 12, 9);
Output :
838:59:59
Application :
This function is used to create and return a time value based on specified hour, minute, and second value.
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...