my dog learned polymorphism*
The moose likes JDBC and the fly likes Difference between two timestamp fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Difference between two timestamp fields" Watch "Difference between two timestamp fields" New topic
Author

Difference between two timestamp fields

JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
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?


SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
Qussay Najjar
Ranch Hand

Joined: Jan 18, 2008
Posts: 53
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..


Qussay NAJJAR
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between two timestamp fields