MySQL SEC_TO_TIME Function

MySQL SEC_TO_TIME function is one of the MySQL Date Functions, which is to convert the user given seconds into a Time value. This SEC_TO_TIME function returns output Time in Hours:Minutes: Seconds format. The basic syntax of the SEC_TO_TIME() Function in MySQL is as shown below:

SEC_TO_TIME(Seconds);

MySQL SEC_TO_TIME function Example

The below shown queries help you understand the use of this MySQL Second to Time function. Here, we are converting different seconds value to Time.

SELECT SEC_TO_TIME(5);

SELECT SEC_TO_TIME(67);

SELECT SEC_TO_TIME(3717);
MySQL SEC_TO_TIME Function 1

In this Date Function example, we are converting seconds to the time. Next, we are adding a few seconds to that output. It means, MySQL return the output as HHMMSS format.

SELECT SEC_TO_TIME(7334);

SELECT SEC_TO_TIME(7334), SEC_TO_TIME(7334) + 0;

SELECT SEC_TO_TIME(10334), SEC_TO_TIME(10334) + 22;
MySQL SEC_TO_TIME Function 2