Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

compare field date from oracle to NOW ?

 
majid nakit
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I have a table that has a column called end_date of type DATE :

ID ------- end_date
23 ------- 10/11/2007

I want to compare the current date with the date end_date returned from the oracle database, could you please help me.

thanks your help is appreciated.
 
Tempora Telora
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have the oracle odbc connection already setup in java?

If so then use java calendar (date was/is depricated).

1.Create a new Calendar object. Calendar cDate = new Calendar() or Calendar cDate =Calendar.getInstance(); I forget which.

2.Use your odbc connection to store the date from your oracle database into a Calendar object. Calendar dbDate = select statement (guessing here)

3. Use cDate.(compareTo(Calendar anotherCalendar) to compare the dates.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic