Skip to content

SEC_TO_TIME

  • seconds: This is an expression that will be converted into seconds. It must be a positive integer of numeric type measuring the time duration in seconds. The output will be a string formatted as “hh
SELECT SEC_TO_TIME(3661);
'01:01:01'

The SEC_TO_TIME function in MySQL converts a number, provided as input, into time format (hours, minutes, and seconds). In the example, the input 3661 seconds is converted to ‘01:01:01’, representing 1 hour, 1 minute, and 1 second.