• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Oracle Date Difference

 
Nischal Tanna
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic