Does your data also record a start date and finish date? If so then you can combine the dates and times to get what you want like so:
start date time = dhms(start date,start hh,start mm, start ss);
end date time = dhms(end date,end hh,e nd mm, end ss);
duration = end date time - start date time;
format duration datetime. ;
If you don't have start and finish dates then its a bit harder. Can a procedure last more than one day? If yes then you have a problem! If not then you can assume if end is less than start then it has gone over just one day boundary:
if end time < start time then duration = end time + 24 - start time;
else duration = end time - start time;
... View more