aspose file tools
The moose likes Beginning Java and the fly likes compare field date from oracle to NOW ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "compare field date from oracle to NOW ?" Watch "compare field date from oracle to NOW ?" New topic

compare field date from oracle to NOW ?

majid nakit
Ranch Hand

Joined: Jun 26, 2001
Posts: 167
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

Joined: Jun 20, 2005
Posts: 83
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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: compare field date from oracle to NOW ?
It's not a secret anymore!