Modulo and floor

Hi everyone

I found a weird behaviour. In my database I have a record of -4’350 (datafield: number and represents the “total minutes worked”)
image

Now on the “customer app” (website) I want to show it in the hh:mm-format.
So I defined the following:

I would expect -72:30, but I get the value:
image

How can I manage that? Many thanks for your support

1 Like

I don’t know if I get you correctly.
Are you trying to display the remainder of the total minute ™ after dividing ™ by 60, cus i see that you make use of ← modulo->?
If you simply want to get the total minutes converted into ours with that format, you just need to divide the ™ by 60, :floor it and format it as…

Hope this helps!

1 Like

This is mathematical problem and is happening because you have a negative number.

:floor will bring the value to the closest lower integer number. The closest lower integer number after -72,5 is -73.

-73 is lower than -72

In your case, -72 is a higher number.
So you will need to use :celling

You are right. So then I would need to use ceilling when the value is negative and floor when it is positive. But is there a proper way to display hh:mm when I have a total of minutes? So another way as I have done it?

The only problem I see in your image is that you need to remove the minus sign before the minutes.

How would you do that? Because the initial value is -4350 and I would like to show the hours and the minutes (should then also be minus).

So the result should be -72:30

I solved it like this but it is not proper:

I used ceiling with the condition that the value is under zero (0). And with the find&replace I removed the minus after the “:”

You could aslso multiply the minutes by -1