FWIW, just want to elaborate on and correct the above tip a bit. Basically, it suggested to convert your Date/Time representation of both ends of your range to unix time (number of seconds since the Epoch). This will give you two integers, each uniquely identifying point in time, to work with. To achieve this you should NOT use localtime as suggested but a core module Time::Local and its timelocal function.
BR
Comment on Re^2: working with time ranges that cross days