How do you want to compare the dates? Do you want to check if one is befor the other in time, if they are equal or what?

Best regards,<br />Mattias

vin Hari
Ranch Hand

Joined: Nov 16, 2006
Posts: 161

posted Dec 04, 2006 06:08:00

0

Hello all, Thank you for reply ,i want to compare dates means date in a database to current date. i have written a query like this, select * from tablename where date<=? means date till today but this is comparing only days not month and year please tell me how to do. vin

Originally posted by vin pll: Hello all, Thank you for reply ,i want to compare dates means date in a database to current date. i have written a query like this, select * from tablename where date<=? means date till today but this is comparing only days not month and year please tell me how to do. vin

I think this pretty much depends on the database you're using. The SQL for Oracle, MySQL and MSSQL varies and they may have their own optimized queries.

SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8

vin Hari
Ranch Hand

Joined: Nov 16, 2006
Posts: 161

posted Dec 09, 2006 02:32:00

0

Hello all, Here iam taking the current date from the textfield and iam writing this in servlet like req.getParameter(date1);//here date1 is the current date of the text box it should compare with the database which is having all the dates of pending fees ok then this should compare all the fields of date but here it is comparing only day please modify this

select * from tablename where date<=?//date is a database field name st.setString(1,date1); iam using preparestatement only .