File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Oracle/OAS and the fly likes Oracle Date Difference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Oracle Date Difference" Watch "Oracle Date Difference" New topic

Oracle Date Difference

Nischal Tanna
Ranch Hand

Joined: Aug 19, 2003
Posts: 182
Hi guys..
I need ur help...
I am having 2 dates the normal oracle date format
Now i want to substract the two dates by only comsidering their hh24:mi:ss format
i.e., '24-jan-2004 20:00:00' - '27-jan-2004 25:00:00' shud give me 05:00:00 ... i.e.,Only the difference in their times shud be the output...i know its unusual requirement..but cant help it...

waiting for ur replies..

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Like in the other thread you had, you need to convert to Date using the to_number() or to_char() data type and do your math there. These functions allow you to specify the format or part of the Date/Time that you want to be able to do your calculations. Remember though, that after you convert your dates, subtraction will loop around 100, and not at 24 or 60.
I think you should visit Ask Tom and do a search, I guarantee you will find an answer there that is the best answer.

Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Oracle Date Difference
It's not a secret anymore!