then at least show us some values for start and endtimes and then show us what should be your expected output. Otherwise we can only keep guessing as we dont know hos the values are nor can we see your system!