Solved

Calculating hours between java dates intersections.

Posted on 2008-10-09
3
730 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

622 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