Hi Virendra,

>From your question, It is diffcult to make out whether you want to compare
dates in SQL or in JAVA.
1) If it is SQL, then the SQL query depends on the DB Vendor. Send more
information about your problem.
Which is your DB Vendor ?
What is the type of field for date1 and date 2 ?

2)If it is Java, then you can create Calendar objects and compare the dates
using 'after', 'before' or == as shown below.
The GregorianCalendar has constructors which accept year, month and day.

        Calendar c1 = new GregorianCalendar();
        Calendar c2 = new GregorianCalendar();
        if (c1.before(c2));
        if (c1.after(c2));
        if (c1 == c2);



Kishore Raghavan
Synapta Inc.



-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Virendra Wathare
Sent: Tuesday, May 02, 2000 5:19 AM
To: [EMAIL PROTECTED]
Subject: Date Comparison!!!


Hi guys,

I have a problem. I want to compare dates in java i.e.
specifically I want to compare 2 date values falling
between a particular range. For e.g.

"Select date1,date2 from table1 where FinishedDate >=
date1 and FinishedDate <= date2  ";

Please could somebody help me regarding the syntax and
the exact comparison operator to be used.

Thanx in advance,

Virendra.



__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to