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 2005 Forums
 Transact-SQL (2005)
 Converting value to days,hours,minutes & seconds

Author  Topic 

ayamas
Aged Yak Warrior

552 Posts

Posted - 2008-05-13 : 10:03:11
Hi Guys,

I have data in minutes which is integer value ex 14454.I wanto convert it to days,hours,minutes & seconds.
Is there any simple way?

Regards.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-05-13 : 10:30:41
[code]DECLARE @Test INT

SET @Test = 14454

SELECT CAST(@Test / 1440 AS VARCHAR(12)) + ' day(s) ' + CONVERT(CHAR(8), DATEADD(MINUTE, @Test % 1440, '00:00'), 108)[/code]


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

ayamas
Aged Yak Warrior

552 Posts

Posted - 2008-05-13 : 14:00:01
Thanks Peso.Works great.Hats of to you.
Go to Top of Page
   

- Advertisement -