Solved

Calculating hours between java dates intersections.

Posted on 2008-10-09
3
710 Views
Last Modified: 2013-12-29
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
Comment
Question by:javabeat
  • 2
3 Comments
 
LVL 13

Expert Comment

by:MicheleMarcon
ID: 22684574
0
 

Author Comment

by:javabeat
ID: 22685075
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
 
LVL 13

Accepted Solution

by:
MicheleMarcon earned 500 total points
ID: 22687200
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

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question