MySQL SEC_TO_TIME() Function
THE WORLD'S LARGEST WEB DEVELOPER SITE

MySQL SEC_TO_TIME() Function

❮ MySQL Functions

Example

Convert numeric seconds into a time value:

SELECT SEC_TO_TIME(1);
Try it Yourself »

Definition and Usage

The SEC_TO_TIME() function converts numeric seconds into a time value (in format HH:MM:SS).

Note: The time values range from "-838:59:59" to "838:59:59".

Syntax

SEC_TO_TIME(seconds)

Parameter Values

Parameter Description
seconds Required. A positive or negative numeric value representing the number of seconds

Technical Details

Works in: MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23

More Examples

Example

Convert numeric seconds into a time value: 

SELECT SEC_TO_TIME(-6897);
Try it Yourself »

❮ MySQL Functions