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 2008 Forums
 Transact-SQL (2008)
 convert minutes to time field

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2012-08-20 : 15:31:59
I have 2 datetime fields and when I do a datediff I get the amount in minutes

how can I convert the minutes fields to datetime so that for example 26 minutes will show as 1900-01-01 00:21

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2012-08-20 : 15:41:53
SELECT CONVERT(VARCHAR(16), DATEADD(MINUTE, 26 - 5, '1900-01-01 00:00:00'), 121)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-20 : 17:11:07
quote:
Originally posted by esthera

I have 2 datetime fields and when I do a datediff I get the amount in minutes

how can I convert the minutes fields to datetime so that for example 26 minutes will show as 1900-01-01 00:21



make sure you read this

http://visakhm.blogspot.com/2012/07/generate-datetime-values-from-integers.html

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

Go to Top of Page
   

- Advertisement -