Open sql server and create following function
- CREATE FUNCTION [dbo].[Fn_SecondsConversion]
- (
- @TimeinSec VARCHAR(MAX)
- )
- RETURNS VARCHAR(MAX)
- BEGIN
- DECLARE @op VARCHAR(MAX)
- SET @op = ''
- SELECT @op=RIGHT('0' + CAST(@TimeinSec / 3600 AS VARCHAR),2) + ':' +
- RIGHT('0' + CAST((@TimeinSec / 60) % 60 AS VARCHAR),2) + ':' +
- RIGHT('0' + CAST(@TimeinSec % 60 AS VARCHAR),2)
RETURN @op - End
This function will accept seconds as parameter and return the Hours: Minutes: Seconds conversion of total second.
Use above function like
- SELECT [dbo].[Fn_SecondsConversion]('30000')
Following output u will get when you run that select query