You may take the numerical difference between the two timestamps. Multiply integer part by 11 and fractional part by 24 to get the hours. This assumes that both the timestamps are in the 7:00 - 18:00 window of time. The attached qvw file shows this simple implementation.
If you have to take into account the non-working hours of holidays and weekends, and if you have to check if the timestamps fall in the working hours, some additional development is needed.
Hope this helps.
WorkHours.qvw.zip 124.8 K
As posted in my own subject;
I have managed to solve the issue, based on an excel example on this site http://chandoo.org/wp/2010/09/10/working-hours-formula/.
The sollution is as follows:
//$1 WorkDayStart. Format 9, 9.5, 21
//$2 WorkDayEnd.Format 9, 9.5, 21
//$3 TimeStampStart. Format DateTime
//$4 TimeStampEnd. Format DateTime
Set fxCalcWorkHours = (($2-$1)*NetWorkDays($3,$4)) -(24*( FMOD($3,1) -($1/24) +($2/24) -FMOD($4,1) ));
So you can load it into a table with the command:
$(fxCalcWorkHours(9,18,StartDateTime, EndDateTime) as WorkHoursSpent;