This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Date range help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Date range help " Watch "Date range help " New topic
Author

Date range help

Connie Kamrowski
Greenhorn

Joined: Aug 15, 2004
Posts: 23
Hi,

I need some help to figure out how to solve my problem.

I have a system which stores details of projects. For each project you have a start and end date and an allocation out of 100 which indicates you time on the project.

When I add a new project I need to go and check if the date range of the new project is inside the date range of any other entry for you, if it is I need to add the proposed allocation to your already stored allocations and see if that totals over 100, if so I need to flag that it totals over 100 and for what dates this occurs and present that back to the user.

I have not used the date functionality in Java and so am unsure how to start


**How much deeper would the ocean be if Sponges didn't grow in it?**
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
Can you share the class? Not sure how the date fields are populated and what data type. You can use getTime() in java.util.Date class. Look at Date class for more details.
Connie Kamrowski
Greenhorn

Joined: Aug 15, 2004
Posts: 23
I am using Hibernate as a middle tier and so my values are all stored in Hibernate objects. I have an object called ProjectAllocation which has your name as ResourceNm, the project name as ProjectNm, a Start Date as StartDt and an End Date as EndDt and an Allocation.

One person can have many objects for their name.

When I am adding a new entry I need to check and see if this will make the resource over allocated.

so I have a new start and End date which I wish to add and a new allocation. This is what I have so far:




So in the code I have got the objects and then pulled the start and end dates and allocation

what I need to do now is to compare the start and end input dates to the ones I have in the database and if they overlap, check if the allocation stored plus the new allocation is over 100, if so warn the user and ask if they still want to add the project, if they say yes then I want to add the record but change the color in the displaypage to red.

Ideally I would like to check week against week. I had read somewhere that I can convert a date range to week of year and then do an overlap but I have no idea how to start.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Date range help
 
Similar Threads
Event Handling
is that any utility class that help compare date within start and end date ?
Need help with how to involving calculations
XSL transformation
Garbage Collection and Virtual Memory