sql

Convert Seconds to Hour : Minute : Seconds Format

A
Desh-Duniya Team Author
| Published August 05, 2019
DECLARE @TimeinSecond INT
SET @TimeinSecond = 125 -- Change the seconds
SELECT RIGHT('0' + CAST(@TimeinSecond / 3600 AS VARCHAR),2) + ':' +
RIGHT('0' + CAST((@TimeinSecond / 60) % 60 AS VARCHAR),2) + ':' +
RIGHT('0' + CAST(@TimeinSecond % 60 AS VARCHAR),2)

Discussion (0)

Please sign in to participate in the discussion.
No comments yet. Be the first to join the conversation!