Calculating hours between java dates intersections.
Posted on 2008-10-09
Hi, ok, im trying to find the best and most effecient way to do the following:
* we have an employee availability for a particular day i.e Monday defined by 2 times (java.sql.Time) i.e start time and end time.
* we have 'unavailability intervals' for advisors throughout the day defined using startDate endDate (java.util.Date)
Problem: I want to calculate the number of hours they are 'available' i.e the general availability times minus the unavailability times.
Is there some cunning set union/intersection based theory that i could apply or is it just a case of hammering out some standard calendar methods and/or getting time as a 'long' then doing some form of millisec substractions etc.....thoughts anyone?