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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Converting Seconds (held as int) into hh:mm:ss

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-07-25 : 11:40:22
paul writes "I have an Integer to hold values in Seconds. I want to display this in ASP in the format hh:mm:ss.

I cannot format in the ASP as I am creating a single ASP page to dynamically display data from various store procs.

I am using the DateAdd function to add the value in Seconds onto '1900-01-01 00:00:00' - to Convert to a DateTime format, but cannot then display it just in hh:mm:ss format.

DECLARE @dt_System as datetime

SELECT @dt_System = CAST('1900-01-01 00:00:00' as datetime)

SELECT
CONVERT(DATETIME, DATEADD(SECOND, actSec, @dt_System), 108) AS actSec
FROM viewname

I want to avoid creating a complex calculation to derive a string from the Integer Value.

When I total this field in Group By statements I may also need to display a day value as well.

Can anyone help ?"
   

- Advertisement -