totn MySQL Functions

MySQL: MAKETIME Function

This MySQL tutorial explains how to use the MySQL MAKETIME function with syntax and examples.

Description

The MySQL MAKETIME function returns the time for a certain hour, minute, second combination.

Syntax

The syntax for the MAKETIME function in MySQL is:

MAKETIME( hour, minute, second )

Parameters or Arguments

hour
The hour value used to create the time.
minute
The minute value used to create the time.
second
The second value used to create the time.

Note

  • Time values range from '-838:59:59' to '838:59:59'.

Applies To

The MAKETIME function can be used in the following versions of MySQL:

  • MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1.1

Example

Let's look at some MySQL MAKETIME function examples and explore how to use the MAKETIME function in MySQL.

For example:

mysql> SELECT MAKETIME(11,28,1);
        -> '11:28:01'

mysql> SELECT MAKETIME(14,31,0);
        -> '14:31:00'

mysql> SELECT MAKETIME(23,59,59);
        -> '23:59:59'

mysql> SELECT MAKETIME(838,59,59);
        -> '838:59:59'

mysql> SELECT MAKETIME(-838,59,59);
        -> '-838:59:59'