Add number in hours

How do i add numbers in 24 hours, let’s say if i want to add 5 to 22 then usually it will be 27, but i want to add a max value of 24, after that it should start count from 0 again, so the outcome i want will be 3.

Add the two numbers together.

If the new number > 24 then subtract 24 from it.

In other words:

a = b + c

If a > 24
then set a to a - 24

Please note this is not a Kodular related query, this forum should only really be used for questions about Kodular.

Why isnt this Kodular related? This can easily be done in blocks.

It’s a math / logic problem.

And can be done in blocks so it is a valid question. I guess the op wants to know how to do it in blocks.

1 Like

He didn’t specify that. If you look at his other topics it appears he knows the basics of Kodular so creating blocks should not be a problem. That’s why I thought it was more the algorithm/code he wanted, not the blocks themselves.

a = (a+ b) mod 24

2 Likes