Hey friends, Sorry for delay in revert as i was not in town for some personal work.....
And thanks for your help..
But I think I have still not able to convey my requirement properly.. I wil explain it once again with exact example.
Example 1.
Start Time 12/1/11 07:00 AM and End Time 12/3/11 9:00 AM.
Here TAT should be 17 Hrs as Start Date or End Date is not a Sunday. My working hours Starts from 7:00 AM and Ends & 10:00 PM so 15 Hrs from 1st Dec & 2 Hrs from 2nd Dec. Total TAT should be 17 Hrs. Means i took 17 Hrs to finish the activity.
Example 2
Start Date 12/4/11 9:00 AM & End Date 12/5/11 9:00 AM
Here TAT should be 02:00 Hrs as Start date is a Sunday and my so 0 Hrs from 4th Dec & End date is Monday. My Working hours start from 7 AM and i have finished the activity @ 9:00 AM so 2 Hrs from 5th Dec.
Example 3
Start Date 12/1/11 11:00 PM & End Date 12/2/11 10:00 AM
Here TAT Should be 3:00 Hrs as both are working day but i got the activity post 10:00 PM on start date which is out of my working hours so 0 Hrs from 1st Dec & have finished my activity on 2nd Dec @ 10:00 AM so 3 Hrs from 2nd Dec.
Also there may be possibility where there is a huge differance between start date and End Date and few sundays in between.
Example 4
Start Date 12/1/11 7:00 AM & End Date 12/20/11 9:00 AM
Here TAT Should be 242 Hrs as shown below.
Dates, Hrs, Day
12/1/11 7:00 AM, 15 Hrs, Thu
12/02/11, 15 Hrs, Fri
12/03/11, 15 Hrs, Sat
12/04/11, 0 Hrs, Sun
12/05/11, 15 Hrs, Mon
12/06/11, 15 Hrs, Tue
12/07/11, 15 Hrs, Wed
12/08/11, 15 Hrs, Thu
12/09/11, 15 Hrs, Fri
12/10/11, 15 Hrs, Sat
12/11/11, 0 Hrs, Sun
12/12/11, 15 Hrs, Mon
12/13/11, 15 Hrs, Tue
12/14/11, 15 Hrs, Wed
12/15/11, 15 Hrs, Thu
12/16/11, 15 Hrs, Fri
12/17/11, 15 Hrs, Sat
12/18/11, 0 Hrs, Sun
12/19/11, 15 Hrs, Mon
12/20/11 9:00 AM, 2 Hrs, Tue
Total Hrs, 242 Hrs.