By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,806 Members | 1,841 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,806 IT Pros & Developers. It's quick & easy.

Time Function?

P: n/a
Hi
How can I convert integer to time .

Ex:
number = 91
Result = 1h 31m

Something like that. I want to do it in DATETIME Function!
Thanks
Dishan

Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
This seems to be about formatting a value for display so I suggest you do
that client-side rather than in the database. SQL Server doesn't have a TIME
datatype so your time will have to include a date as well. You can just
ignore the date unless the time value exceeds 86400 (24 hrs) in which case
your "time" value will then no longer make sense without a value in days as
well. I'll assume that isn't a problem for you. Try:

DECLARE @i INTEGER
SET @i = 91
SELECT DATEADD(mi,@i,0)

--
David Portas
SQL Server MVP
--
Jul 23 '05 #2

P: n/a
DECLARE @mint INTEGER
SET @mint = 91
SELECT convert(varchar(5),DATEADD(mi,@mint,0),114)
Got it down to h:mi truncating date
RA
MCDBA

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.