Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between two timestamp fields

 
JayaSiji Gopal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two fields DECISION_DATE and EVENT_DATE
Both are of type Timestamp in the database(DB2 v8)

i want to check if the diff between the two dates is 1.

I tried days(DECISION_DATE) - days(EVENT_DATE) = 1 .

I get the exception: days() is not a valid function.

What would be the best way?
 
Qussay Najjar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi JayaSiji,
Honestly I don't know the solution for this using Java methods,
I've faced this problem before, but as I'm using Oracle DB I used a query as the next:


This is how I solved my problem that day, hope it helps or gives a clue..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic