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 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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Oracle Date Difference" Watch "Oracle Date Difference" New topic
Author

Oracle Date Difference

Nischal Tanna
Ranch Hand

Joined: Aug 19, 2003
Posts: 182
Hi guys..
I need ur help...
I am having 2 dates ..in 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..
regards,
Nischal


Thnx
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

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.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Oracle Date Difference
 
Similar Threads
Working with Dates
Calculating days between two dates
caculating the difference between dates
DB2 Date format to Oracle Date format?
Calculation of months between two dates