Solved

Calculating hours between java dates intersections.

Posted on 2008-10-09
3
714 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
factorial example 4 47
eclipse apache tomcat admin console 52 121
sql import cannot be resolved jsp 3 46
Java: anonymous class 4 29
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

856 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