MySQL MAKETIME() function
MAKETIME() function
MySQL MAKETIME() makes and returns a time value from a given hour, minute and seconds. The value of hour may be greater than 24 but the value of minutes and second greater than 59 return NULL.
This function is useful in -
- MAKETIME() is valuable for generating custom time values with specific hour, minute, and second components.
- MAKETIME() aids in time-based analysis, allowing you to generate specific time points for data examination.
- MAKETIME() helps represent time values for custom purposes that do not follow the standard hour-minute-second format.
- When working with datasets that include hour, minute, and second components, MAKETIME() is used to generate accurate time values for further processing.
- MAKETIME() aids in scenarios where time-dependent logic needs to be applied, such as triggering actions at specific times.
- The function supports calculations involving time values, allowing for adjustments and transformations.
- In applications that require the initialization of time-related data, MAKETIME() helps create initial time values.
Syntax:
MAKETIME(hour,minute,second);
Arguments:
Name | Description |
---|---|
hour | Indicates an hour. |
minute | Indicates minutes. |
second | Indicates seconds. |
Syntax Diagram:
MySQL Version: 8.0
Pictorial Presentation:
Example: MySQL MAKETIME() function
The following statement will make a time value from 15 hours, 25 minutes and 36 seconds.
Code:
SELECT MAKETIME(15,25,36);
Output:
mysql> SELECT MAKETIME(15,25,36); +--------------------+ | MAKETIME(15,25,36) | +--------------------+ | 15:25:36 | +--------------------+ 1 row in set (0.01 sec)
Video Presentation:
All Date and Time Functions:
Click here to see the MySQL Date and time functions.
Previous: MAKEDATE()
Next: MICROSECOND()
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/mysql/date-and-time-functions/mysql-maketime-function.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics