Converting number of seconds to a string

 

horizontal rule

Back Home

Author Aart Onkenhout
Date 12-10-2000

 

An easy way to convert a couple of seconds to a string with the format hh:mm:ss is:

 

Select convert( varchar(8), DateAdd( ss, number_of_seconds, '2000-01-01 00:00:00' ), 108 )

 

E.g.: replacing number_of_seconds with 123 results in: 00:02:03.