Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I need to calculate how many hours there are between a persons work shifts in a
schedule, his "resting time" so to speak.
My table is simple: id_number, timestamp_from, timestamp_to.
My code so far...
LOAD
id_number,
timestamp_from,
timestamp_to,
Interval(Previous(timestamp_to) - timestamp_from, 'hh:mm') as rest_time
FROM ....
Problem...
The resulting hours in rest_time is a negative number...how to make it into a positive number?
Thanks
Hi,
Just change from and to column positions in Load script..
LOAD
id_number,
timestamp_from,
timestamp_to,
Interval(timestamp_from - Previous(timestamp_to) , 'hh:mm') as rest_time
FROM ....
Regards,
Jagan.
Hi,
Use Fabs() function for positive.
But check your timestamp fields format Interval() function will return correct hours.
Hi,
Just change from and to column positions in Load script..
LOAD
id_number,
timestamp_from,
timestamp_to,
Interval(timestamp_from - Previous(timestamp_to) , 'hh:mm') as rest_time
FROM ....
Regards,
Jagan.
try this way
Interval(timestamp_to - timestamp_from, 'hh:mm') as rest_time
Hi,
Please find the attached file. I hope it helps you
Thanks and Regards,
S. Amuthabharathi
Thanks 🙂 it helped