You might want to check out this thread and the sample workflow with ranges and the H2 database
Maybe you could provide us with a sample workflow that would demonstrate your whole pronblem so we might search for a genuine solution.
Concerning your date and time variables are in a string format you could check out this blood with examples how to convert them and work with them
Another thing you might try would be to convert your date/time variables into numbers and just see if they are in-between them. If your task is complicated you might have to revert to loops for each individual ID - but maybe a join setting with a BETWEEN statement might be enough.