Hi Srinivas,
This is little long..but works.
=NETWORKDAYS(A1,B1)*9-IF(HOUR(A1)<8,0,(TIME(HOUR(A1),MINUTE(A1),SECOND(A1))-TIME(8,0,0))*24)+IF(HOUR(B1)>17,0,(TIME(HOUR(B1),MINUTE(B1),SECOND(B1))-TIME(17,0,0))*24)
Change the format of the cell to general to see the time difference in...