Date & Time

SEC_TO_TIME

MySQLMySQL

Mengkonversi detik ke format TIME (HH:MM:SS). Kebalikan dari TIME_TO_SEC().

Tipe hasil: TIMEDiperbarui: 7 Jan 2026

Syntax

SQL
SEC_TO_TIME(seconds)

Parameter

secondsINTwajib

Jumlah detik

Contoh Penggunaan

Convert Seconds

SQL
1SELECT SEC_TO_TIME(3600) AS time_val;

3600 detik = 1 jam.

Hasil
time_val: 01:00:00

Over 24 Hours

SQL
1SELECT SEC_TO_TIME(90061) AS time_val;

Lebih dari 24 jam = 25:01:01.

Hasil
time_val: 25:01:01

Calculate Duration

SQL
1SELECT task_name,
2 SEC_TO_TIME(duration_seconds) AS duration
3FROM tasks;

Display durasi dalam format time.

Hasil
(readable durations)