Finally I have been able to find a solution. Very close to the answer of Thomas.Using Left , mid and right functions first convert the number to time format andthen it's quite easy task.