Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Difference between two timestamp fields

 
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?
 
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..
    Bookmark Topic Watch Topic
  • New Topic