| Author |
Topic |
|
sanjay5219
Posting Yak Master
240 Posts |
Posted - 2008-08-12 : 15:12:32
|
| Dear All,I want diffrence between in Minutes but actually it should calculate based on working daysEx;2008-08-08 07:28:56.0002008-08-12 07:28:56.000Now 8th August is friday so answer should not calculate Saturday and SundayPlease Help Me |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-08-12 : 15:18:19
|
| select datediff(n, '2008-08-08 07:28:56.000', '2008-08-12 07:28:56.000') - 60*24*260*24*2 = 60 minutes * 24 hours * 2 days_______________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.0 out! |
 |
|
|
sanjay5219
Posting Yak Master
240 Posts |
Posted - 2008-08-12 : 15:20:20
|
| It is showing InCorrect Syntax Near 60 |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-08-12 : 15:21:25
|
| well you just ned to run the select. not the math explanation below._______________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.0 out! |
 |
|
|
sanjay5219
Posting Yak Master
240 Posts |
Posted - 2008-08-12 : 15:27:39
|
| But output is coming in date format i want in Minutesselect dateadd(d, -60*24*2, datediff(n, travel_date, travel_date)) from <tablename>Answer is coming1909-11-21 00:00:00.0001896-11-26 00:00:00.0001905-11-30 00:00:00.0001904-05-13 00:00:00.0001908-02-05 00:00:00.0001896-12-14 00:00:00.0001904-09-13 00:00:00.0001898-10-14 00:00:00.000 |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-08-12 : 15:30:38
|
try the version i edited _______________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.0 out! |
 |
|
|
sanjay5219
Posting Yak Master
240 Posts |
Posted - 2008-08-12 : 15:33:07
|
| I didn't get u |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-08-12 : 15:36:05
|
| select datediff(n, '2008-08-08 07:28:56.000', '2008-08-12 07:28:56.000') - 60*24*2_______________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.0 out! |
 |
|
|
sanjay5219
Posting Yak Master
240 Posts |
Posted - 2008-08-12 : 15:43:51
|
| i ran your query select datediff(n, '2008-08-08 07:28:56.000', '2008-08-12 07:28:56.000') - 60*24*2 : Answer got 2880I ran another query select datediff(n, '2008-08-08 07:28:56.000', '2008-08-08 07:30:56.000') - 60*24*2 : Answer -2878but actually for second query answer should come 2 |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
|
|
|