Open In App

SEC_TO_TIME() Function in MySQL

SEC_TO_TIME() function :
This function in MySQL is used to return a time value based on the specified seconds value. Here the returned time value will be in the format of HH:MM:SS. For example, if the specified second value is 63, this function will return “00:01:03”.

Syntax :



SEC_TO_TIME(seconds)

Parameter :
This method accepts a parameter as given below :

Returns :
It returns a time value based on the specified seconds value.



Example-1 :
Getting the time value of “00:00:40” from the specified parameter of 40 seconds value.

SELECT SEC_TO_TIME(40);

Output :

00:00:40

Example-2 :
Getting the time value of “00:01:10” from the specified parameter of 70 seconds value.

SELECT SEC_TO_TIME(70);

Output :

00:01:10

Example-3 :
Getting the time value of “01:00:04” from the specified parameter of 3604 seconds value.

SELECT SEC_TO_TIME(3604);

Output :

01:00:04

Application :
This function is used to return a time value based on the specified seconds value.

Article Tags :
SQL