Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
asobreiro
Starting Member
2 Posts |
Posted - 2012-12-20 : 14:26:44
|
hellohow do you make a function to convert seconds into hours, minutes and seconds??? |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-12-20 : 14:34:24
|
[code]CREATE FUNCTION GetTime(@Seconds int)RETURNS varchar(100)ASBEGINDECLARE @TimeVal varchar(100),@dateVal datetimeSET @dateVal = DATEADD(ss,@Seconds,0)SET @TimeVal = CAST(DATEDIFF(dd,0,@dateVal)* 24 + DATEPART(hh,@dateVal) AS varchar(5)) + ':' + DATENAME(n,@dateVal) + ':' + DATENAME(ss,@DateVal) RETURN @TimeValEND[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
asobreiro
Starting Member
2 Posts |
Posted - 2012-12-20 : 15:14:35
|
Thank you very much |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-12-21 : 00:46:49
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|