 # MAKETIME() Function Examples – MySQL

Learn MAKETIME() function uses with examples. We would love to demonstrate to you how to works MySQL maketime() function with its syntax and examples.

## MySQL MAKETIME() Function

In MySQL, MAKETIME() function is used to returns the time from the different time parts.

Note:-
In this maketime() function, you can pass three parameters, first is hours, second is minute, and third is seconds. It will return the time value passed on this function.

### Syntax

The syntax of MAKETIME() function is:

` MAKETIME(hour,minute,second);`

Here we demonstrate :

• The hour is the hour part.
• The minute is the minutes part.
• Second is the seconds part.

#### Example-1

Let’s take the first basic example of this maketime() function. See the below:

`SELECT MAKETIME(10,35,17);`

#### Output-1

```+--------------------+
| MAKETIME(10,35,17) |
+--------------------+
| 10:35:17           |
+--------------------+
```

#### Example-2

Nextt, we take another example with a fractional part. Let’s see below:

`SELECT MAKETIME(10,35,17.123456);`

#### Output-2

```+---------------------------+
| MAKETIME(10,35,17.123456) |
+---------------------------+
| 10:35:17.123456           |
+---------------------------+
```

#### Example-3

Part of the hour is not limited to 0 to 23 limits. Time can probably represent the time or time elapsed between two incidents.

`SELECT MAKETIME(100,35,17);`

#### Output-3

```+---------------------+
| MAKETIME(100,35,17) |
+---------------------+
| 100:35:17           |
+---------------------+
```

#### Example-4

However, this does not apply to the minute part. It should be within range 0 to 59:

```SELECT
MAKETIME(10,-1,17),
MAKETIME(10,60,17);
```

#### Output-4

```+--------------------+--------------------+
| MAKETIME(10,-1,17) | MAKETIME(10,60,17) |
+--------------------+--------------------+
| NULL               | NULL               |
+--------------------+--------------------+
```

#### Example-5

However, this also does not apply to the second part. It should be within range 0 to 59:

```SELECT
MAKETIME(10,35,-1),
MAKETIME(10,35,60);
```

#### Output-5

```+--------------------+--------------------+
| MAKETIME(10,35,-1) | MAKETIME(10,35,60) |
+--------------------+--------------------+
| NULL               | NULL               |
+--------------------+--------------------+```

### Conclusion

Here, you have learned how to use MySQL MAKETIME() function with various examples.

If you have any questions or thoughts to share, use the comment form below to reach us.

#### Recommended Post

List Of MySQL Date/Time Functions