>I suspect some dates have time in them and also Michel is using floating math by using 86400.00, for example. Try that for your example.
>
>Interestingly, I can not reproduce the problem myself anymore in my tests although first time I tried I also got incorrect result.
>
>Tried several tests, but it's now working OK for me every time. But I am absolutely sure that earlier today when I first tested I got wrong results.
I need to do some reorg in that. The first thing would be to use positive approach such as storing working hours instead. By that, I wouldn't have to do a post process to substract from the maximum range the subset found. I also need to adjust some data as it was not properly built. I will post my findings once I sort this out.