Hi team,

I have a requirement for implementing the below logic:

calculate Duration Hours with the difference between the end time(data type 'Time') and start time(data type 'Time'), rounded to the nearest half-hour (.5):
end time - start time = number of hours (minimum 0.5, maximum 24).


Thanks

Hello Angel,


You have a lot of inbuilt functions to calculate the difference in times between two DateTime type variables.

They're in the Date and Time folder



Hello Angel.

You have DiffMinutes function that will tell you a number between 0 and 24*60 for that difference.

If you divide it by 30 using round(), you get the integer number of half hours. Then divide by 2 and you have the 0.5 hour detail.

If you charge in multiples of 0.5 hours, then add 30 minutes to the original time and use trunc to remove the excess when dividing by 30 but before the division by 2.