Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Add Subtract Time using SQL

807603Jan 5 2008 — edited Jan 5 2008
I'm currently trying to subtract two military times to get the number of hours someone has been doing work.
My code looks like this:
java.sql.Time insertTime= java.sql.Time.valueOf(timeIn);

java.sql.Time timeOut= java.sql.Time.valueOf(timeOut);
When I go to the methods, getHour(), its deprecated, and its not the true since of an hour. So how do I convert the sql.Time object into longs so I can subtract them and then convert them back to number of hours?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 2 2008
Added on Jan 5 2008
7 comments
779 views