A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
this week in the
Java in General
finding difference b/n two dates in hours
Joined: Oct 05, 2004
Oct 06, 2004 01:37:00
I have two datetime formats rpt_dt_time and cur_dt_time , I want to find the difference between these dates in hours and check wether it has crossed the estimated time and act accordingly.I am working on Oracle DB and Windows 2000 OS
Joined: Apr 29, 2004
Oct 06, 2004 08:03:00
I don't think it would be appropriate to just give you the solution (which would be quite an amount of code), but there are a few subjects you must know in order to implement the solution:
: Read the API and
Tutorial on the subject. You will need it to connect and execute your queries to the Oracle DB (you will need the Oracle JDBC driver)
- Check out the
classes, you will surely need some of them.
Then write some code and if you fail to achieve the answer to your problem we will gladly help you. Regards,
Joined: Dec 17, 2003
Oct 06, 2004 08:15:00
After looking at the Java Tutorial and API documentation, you can also take a look at these articles at
Calculating Java dates
Working in Java time: Learn the basics of calculating elapsed time in Java
Joined: Sep 28, 2004
Oct 06, 2004 08:29:00
If I may make a suggestion. I ran into a similar problem with an application that we were developing. The solution we chose was to calculate the difference in milliseconds.
The reson we selected this route is if we had a scenario like;
12-31-2002 23:59:59 and 01-01-2003 00:00:01
-- The real time difference is only 2 seconds.
So using the hour approach would have been inadequate in our situation.
Joined: Oct 05, 2004
Oct 07, 2004 01:00:00
Thanks for the reply . I am able to make up the solution
I agree. Here's the link:
subject: finding difference b/n two dates in hours
How to calculate difference between two dates in months
difference between two dates
DateDiff Function in Java?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015