My Anna

Indias Biggest Engineering Education Community Enriching Students Minds with Latest Placement Papers, Study Materials, Fresher Jobs and Free E Books

A Unit of Aim Clear Technologies Ltd.
Search Study Materials, Jobs, Placement Papers, Interview Tips, Training Videos & More

Advertise with us

Who is online



Post new topic Reply to topic  [ 1 post ] 

sreenath
Super Moderator
Super Moderator
User avatar

Joined:
Wed Aug 26, 2009 10:01 pm
Beans: 1,227
In Bank: 14665
College: ESEC
Degree: M.Sc
Department: CSE
State: TN
Fav Quote: no pain no gain
 
#2
Fri Oct 02, 2009 8:12 am
Post subject: Convert Number of Seconds to 00:00:00 Format Post
There may be a time in your career where you are given a number of seconds and need to convert it to Hour:Minute:Second format. This is a pretty common task, and writing a client side solution for it is pretty simple. On the other hand, it's unnecessary thanks to some of SQL Server's intrinsic functions and date formatters:

So, let's say that you had a field called Total_Seconds and you needed to format is as mentioned above. Basically, this little code snippet can do it for you:

CONVERT(VARCHAR,DATEADD(s,Total_Seconds,'19000101'),8) AS 'Some Alias'


That's all there is to it!
_________________
sreenath@myanna.inImage


Profile E-mail
Offline

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 
Bookmark & Share

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB Group.

phpBB SEO