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.
Author |
Topic |
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2013-06-03 : 09:18:30
|
declare @duration datetimeselect @duration='1900-01-01 00:53:00.000'I need to know how to convert this so I get the number of minutes(I want returned 53) |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2013-06-03 : 09:26:54
|
declare @duration datetimeset @duration='1900-01-01 00:53:00.000'select@duration,datepart(minute,@duration) Too old to Rock'n'Roll too young to die. |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-06-03 : 09:26:56
|
declare @duration datetimeselect @duration='1900-01-01 00:53:00.000'SELECT DATEPART(MI, @Duration)--Chandu |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-06-03 : 23:59:59
|
declare @duration datetimeselect @duration='1900-01-01 00:53:00.000'SELECT DATEDIFF(MI,0, @Duration)------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2013-06-04 : 02:07:11
|
thanks |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-06-04 : 03:21:02
|
quote: Originally posted by esthera thanks
welcomeWhich one you used?As per Visakh's post, DATEDIFF(MI,0, @Duration) gives you the number of seconds from date 1900-01-01Check the difference between two postsdeclare @duration datetimeselect @duration='2013-01-01 00:53:00.000'SELECT DATEPART(MI, @Duration)SELECT DATEDIFF(MI, 0, @Duration)--Chandu |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2013-06-04 : 03:48:23
|
thanks for pointing that outI tried that different options and ended up usingdeclare @duration datetimeselect @duration='1900-01-01 00:53:00.000'SELECT DATEPART(MI, @Duration)which seems to be what i want |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-06-04 : 03:52:56
|
quote: Originally posted by esthera thanks for pointing that outI tried that different options and ended up usingdeclare @duration datetimeselect @duration='1900-01-01 00:53:00.000'SELECT DATEPART(MI, @Duration)which seems to be what i want
OK... --Chandu |
|
|
|
|
|
|
|