Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Convert Number in HH:mm:ss
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

giannilionetti
Starting Member

3 Posts

Posted - 01/17/2013 :  05:41:55  Show Profile  Reply with Quote
I need to Convert a number without decimal in HH:mm:ss

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 01/17/2013 :  05:52:58  Show Profile  Reply with Quote
What is content of the number? is it YYYYMMDDHHmmss or HHmmss or something else? Post some sample data?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 01/17/2013 :  05:53:58  Show Profile  Reply with Quote
just do like example below provided number represents seconds

DECLARE @Number int
SET @Number=234
SELECT CONVERT(varchar(8),DATEADD(ss,@Number,0),108)



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 01/17/2013 :  05:57:23  Show Profile  Reply with Quote
also see

http://visakhm.blogspot.in/2010/03/time-difference-function.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22864 Posts

Posted - 01/17/2013 :  06:05:10  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
In 2012, you can also do

select format(getdate(),'hh:mm:ss')


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000