Niels
If you have the beginning of a day in a variable, you can create another variable to contain end of day and use the addHours or addMinutes function to add the correct amount of time to get the end of day time you would like. In this way, you could build a loop that would maintain a variable with hours remaining, decrement hours remaining as you work your way through the days and finish when you are done processing your hours.
Hope that helps,
Mike
Neils:
While I've only got limited experience with the Mendix Calendar Widget, one suggestion that may simplify things a bit is to use contiguous calendar events rather than a series of events with "annoying little gaps" between them. If you do this then the end of the current day is actually "the start of the next day" and your daily boundaries become the start of today, the start of tomorrow, the start of the next day, etc.
So, today is 14 October 2014 and starts at 00:00:00. The end of today is actually 15 October 2014 00:00:00 and has a duration of exactly 24 hours, 0 minutes, and 0 seconds.
So, in your case rather than splitting a multi-day calendar event into several that may have durations of 23H59M or 23H59M59S, I suggest splitting them into "touching" calendar events where one stops at 00:00:00 and the next one starts at 00:00:00.
I've at least confirmed in my test Mendix environment that a reservation that starts on 14 October 2014 00:00:00 and ends on 15 October 2014 at 00:00:00 is displayed only on October 14 and is naturally calculated as a duration of 24H00M00S.
Of course, if you adopt this approach and have a microflow that prevents overlapping reservations, you need to make your checks work so that a calendar event that ends at the same time that the next one begins is merely "touching" but not an overlapping pair of calendar events.
Good luck,
John