| Author |
Topic |
|
BankOfficerHere
Posting Yak Master
124 Posts |
Posted - 2009-02-12 : 07:27:08
|
| I would like to get the difference of the 2 dates as follows:2/13/2009 3:45:52 PM 2/12/2009 3:43:36I want the difference to be in hours. Like in this case 24.7777 something like that.Thanks |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-02-12 : 07:28:40
|
| See DateDiff . |
 |
|
|
BankOfficerHere
Posting Yak Master
124 Posts |
Posted - 2009-02-12 : 07:29:29
|
| yes i tried, how's it? thanks |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-02-12 : 07:30:51
|
| select datediff(d,'2/12/2009 3:43:36','2/13/2009 3:45:52') |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-02-12 : 07:31:40
|
| select datediff(mi,'2/12/2009 3:43:36','2/13/2009 3:45:52') |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-02-12 : 07:35:31
|
| SELECT CAST(datediff(hh,'2/12/2009 3:43:36','2/13/2009 3:45:52') AS VARCHAR(32))+'.'+CAST(datediff(mi,'2/12/2009 3:43:36','2/13/2009 3:45:52') AS VARCHAR(32)) + '.'+CAST(datediff(ss,'2/12/2009 3:43:36','2/13/2009 3:45:52') AS VARCHAR(32)) as 'DateDiff' |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-02-12 : 07:38:04
|
| If u want in hours the use thisselect datediff(hh,'2/12/2009 3:43:36','2/13/2009 3:45:52') |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-02-12 : 07:52:32
|
select datediff(minute,'2/12/2009 3:43:36','2/13/2009 3:45:52') / 60.0Eas per OP requested... E 12°55'05.63"N 56°04'39.26" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-02-12 : 07:53:42
|
quote: Originally posted by Nageswar9 SELECT CAST(datediff(hh,'2/12/2009 3:43:36','2/13/2009 3:45:52') AS VARCHAR(32))+'.'+CAST(datediff(mi,'2/12/2009 3:43:36','2/13/2009 3:45:52') AS VARCHAR(32)) + '.'+CAST(datediff(ss,'2/12/2009 3:43:36','2/13/2009 3:45:52') AS VARCHAR(32)) as 'DateDiff'
Let's check the result, shall we?Result---------------24.1442.86536It seems you also need to read the article provided in the link above. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|