Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 742
  • Last Modified:

Calculating hours between java dates intersections.

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)
I
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?
0
javabeat
Asked:
javabeat
  • 2
1 Solution
 
MicheleMarconCommented:
0
 
javabeatAuthor Commented:
yeah, i'd looked at joda time but it didn't seem to provide this kind of functionality and seemed to be more of an api to tighten up the standard java date/time api?
0
 
MicheleMarconCommented:
This is the best timing api (it is planned for inclusion for Java 7), so this is the best starting point you can have.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now